C语言编程题目,求大神解析!
C语言编程题目,求大神解析!已知structteacher{charname[8];chargender;unsignedlongintid_num;floatsalar...
C语言编程题目,求大神解析!
已知
struct teacher
{
char name[8];
char gender;
unsigned long int id_num;
float salary;
}t[20];
struct teacher *pt=t;
请问指针p执行p++时,增加的字节数是多少? 展开
已知
struct teacher
{
char name[8];
char gender;
unsigned long int id_num;
float salary;
}t[20];
struct teacher *pt=t;
请问指针p执行p++时,增加的字节数是多少? 展开
3个回答
2019-11-26
展开全部
应该是一个t数组元素的sizeof
请看
printf("len %d\n",sizeof(t[0]));
printf("pt %ld\n",pt);
pt++;
printf("diff %ld\n",pt);
运行结果
len 32
pt 93988814753888
diff 93988814753920
请看
printf("len %d\n",sizeof(t[0]));
printf("pt %ld\n",pt);
pt++;
printf("diff %ld\n",pt);
运行结果
len 32
pt 93988814753888
diff 93988814753920
追问
请问可以做更详细一点的解释吗?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
执行p++后,字节数增加400。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询