指针和二维数组
#include<stdio.h>int main (void)
{
int array={0};
int i,j,k;
for(i=0;i<4;i++)
{
for(j=0;j<5;j++)
{
array=k++;
}
}
// (&)取址地址 (*)取值 数值
printf("sizeof int:%d\n",sizeof(int));
printf("sizeof array:%d\n",sizeof(array));
printf("\n");
printf("array:%p\n",array);
printf("&array:%p\n",&array);
printf("\n");
printf("array+1:%p\n",array+1);
printf("&array+1:%p\n",&array+1);
printf("\n");
printf("*(array+1):%p\n",*(array+1));
printf("**(array+1):%p\n",**(array+1));
printf("*(*(array+1)+0):%p\n",*(*(array+1)+0));
printf("\n");
printf("array:%p\n",array);
printf("&array:%p\n",&array);
printf("\n");
printf("array:%p\n",array);
printf("&array:%p\n",&array);
printf("\n");
printf("*(*(array+1)+03):%p\n",*(*(array+1)+3));
printf("\n");
printf("array:%p\n",array);
printf("&array:%p\n",&array);
printf("\n");
printf("\n");
printf("array:%d\n",array);
printf("&array:%d\n",&array);
printf("\n");
printf("array+1:%d\n",array+1);
printf("&array+1:%d\n",&array+1);
printf("\n");
printf("*(array+1):%d\n",*(array+1));
printf("**(array+1):%d\n",**(array+1));
printf("*(*(array+1)+0):%d\n",*(*(array+1)+0));
printf("\n");
printf("array:%d\n",array);
printf("&array:%d\n",&array);
printf("\n");
printf("array:%d\n",array);
printf("&array:%d\n",&array);
printf("\n");
printf("**(array+1)+3:%d\n",**(array+1)+3);
printf("*(*(array+1)+03):%d\n",*(*(array+1)+3));
printf("\n");
printf("array:%d\n",array);
printf("&array:%d\n",&array);
return 0;
}
页:
[1]