码迷,mamicode.com
首页 > 其他好文 > 详细

结构体变量的++

时间:2016-09-08 00:34:10      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:

技术分享
 1 #include<iostream>
 2 #include<ctime>
 3 #include <stdio.h>
 4 #include<cstring>
 5 #include<cstdlib>
 6 #include <map>
 7 #include <string>
 8 #if 1
 9 using namespace std;
10 struct product{
11     int x;
12     char buf[33];
13 }STPRODUCT[1000];
14 int main(){
15     struct product pt[] = {{2,"qwert"},{5,"asdfg"}};
16     struct product *p = pt;
17     p++;
18     printf("%d %s\n",p->x, (*p).buf);
19     printf("%d %s\n",pt[0].x, (*pt).buf);
20     /*数组名为常量指针。不能++
21     pt++;//error
22     printf("%d\n",(*pt).x);
23     */
24 }
25 #endif
View Code

 

结构体变量的++

标签:

原文地址:http://www.cnblogs.com/guxuanqing/p/5851424.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!