首页 > 代码库 > *一个二级指针的练习(输入一个数,输出对应的月份)

*一个二级指针的练习(输入一个数,输出对应的月份)

  1 #include <stdio.h>  2   3 int funk(int n, char **p)  4 {  5         if(n > 0 && n<13)  6                 printf("time is %s\n", *(p+n-1));  7 }  8   9 int main() 10 { 11         char *arr[12] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; 12  13         int i = 3; 14         char **p = arr; 15         funk(i, p); 16 }

arr数组里面存的是 地址,如果p再想存 arr(数组首地址),就得写成 二级指针 char **p

*一个二级指针的练习(输入一个数,输出对应的月份)