Output the English name of the month--C language implementation

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:

  1. type *var-name;

Here, typeis the base type of the pointer, which must be a valid Cdata 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:

 
 
  1. int *ip; /* 一个整型的指针 */
  2. double *dp; /* 一个 double 型的指针 */
  3. float *fp; /* 一个浮点型的指针 */
  4. 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:

 
 
  1. 类型名 *数组标识符[数组长度]

For example:

 
 
  1. char *arr[4] = {&#

おすすめ

転載: blog.csdn.net/qq_58476985/article/details/129186297