mission details
This level requires you to write a program that uses an array of pointers to process c
, and then output the corresponding English name when the month is input from the keyboard.
related information
pointer
A pointer is a variable whose value is the address of another variable, the direct address of a memory location. Just like any other variable or constant, you must declare a pointer before using it to store the address of another variable.
The general form of a pointer variable declaration is:
type *var-name;
Here, type
is the base type of the pointer, which must be a valid C
data type, and var-name
is the name of the pointer variable. The asterisk used to declare pointers *
is the same one used in multiplication. However, in this statement, the asterisk is used to designate that a variable is a pointer. The following are valid pointer declarations:
int *ip; /* 一个整型的指针 */
double *dp; /* 一个 double 型的指针 */
float *fp; /* 一个浮点型的指针 */
char *ch; /* 一个字符型的指针 */
array of pointers
Everyone knows about arrays, but what is an array of pointers? In C language, an array whose elements are all pointers is called a pointer array.
The definition form of a one-dimensional array of pointers is:
类型名 *数组标识符[数组长度]
For example:
char *arr[4] = {&#