标签:style io ar os sp for strong on amp
//多为数组的指针学习}
//指针与二维数组
//利用指针查看每个元素在内存的地址是多少?
//急事把指针指向每个内存单元的开始
//例如 &date[i][j] 就是去每个元素的地址的意思。
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int date[4][5] = {{1, 2, 3, 4, 5}};
printf("每个元素的地址是:");
for(int i = 0; i < 4; ++i)
{
for(int j = 0; j < 5; ++j)
{
printf("%p\t", &date[i][j]);
}
printf("\n");
}
return 0;
}
//指针的指针
//
//int * *date;
//指向指针变量的指针;
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
char *name[] = {"China", "BeiJing", "LongMai"};
char ** p_name;
printf("name[0] :%p\n", name[0]);
printf("name[1] :%p\n", name[1]);
printf("name[2] :%p\n", name[2]);
printf("\n");
p_name = &name[0];
printf("&name[0] : %p\n", p_name);
p_name = &name[1];
printf("&name[1] : %p\n", p_name);
p_name = &name[2];
printf("&name[2] : %p\n", p_name);
printf("\n");
return 0;
}
标签:style io ar os sp for strong on amp
原文地址:http://blog.csdn.net/u012965373/article/details/41795859