数组名同时也是该数组首元素的地址: 比如 name=&name[0]
对于 字符串的输入,可以用数组来写
int main()
{
char name[40];
scanf("%s",name);
printf("%s",name);
}
程序清单: P254页 (C primer )
1 #include<stdio.h> 2 #define SIZE 4 3 int main() 4 { 5 short datas[SIZE]; 6 short *pti; 7 8 short index; 9 10 double bills[SIZE]; 11 double *ptf; 12 13 pti=datas; 14 ptf=bills; 15 printf("%23s %10s","short","double\n"); 16 for(index=0;index<SIZE;index++) 17 printf("pointers+%d: %10p %10p \n", 18 index, pti+index,ptf+index); 19 return 0; 20 21 }
shenhui
好困,先睡一觉再说
时间: 2024-11-05 16:31:11