【c/c++|C语言:结构体与数组】
#include struct book{ char title[100]; char author[100]; int price; }; int arr[10] = {1,2,3,4,5,6,7,8,9,10}; int main(){ struct book *ps1; struct book c = { "PHP最佳实践", "jimmy", 67, }; printf("%p\n",c); printf("%p\n",&c.title); //1 结构体指针的赋值 ps1 = &c; //数组指针的赋值 int *ps2; ps2 = arr; //结构体数组 struct book d[10]; struct book *ps3; ps3 = &d[0]; //二维数组 int arr2[2][4] = {1,2,3,4,5,6,7,8}; int (*ps4)[4]; ps4 = arr2; printf("%d,%d\n",*(*ps4+1),*(*(ps4+1)+2)); }
转载于:https://www.cnblogs.com/bai-jimmy/p/4470898.html
推荐阅读
- c/c++|有感 Visual Studio 2015 RTM 简介 - 八年后回归 Dot Net,终于迎来了 Mvc 时代,盼走了 Web 窗体时代...
- C/C++|C/C++ basis 02
- Qt实战|Qt+OpenCV联合开发(二十一)--图像翻转与旋转
- Qt实战|Qt+OpenCV联合开发(十四)--图像感兴趣区域(ROI)的提取
- Qt实战|Qt+OpenCV联合开发(十三)--通道分离与合并
- opencv|Qt+OpenCV联合开发(十六)--图像几何形状绘制
- Qt实战|Qt+OpenCV联合开发(十七)--随机数与随机颜色
- SNAT的MASQUERADE地址选择与端口选择
- IPTABLES的连接跟踪与NAT分析
- IPVS分析