首页新闻找找看学习计划

*pointer++,*(pointer++),*(pointer+1)这三种操作有啥区别??

0
[待解决问题]

场景1:
int count = 6;
int * pointer = &count ;
printf("%d",* pointer++);
场景2:
int count = 6;
int * pointer = &count ;
printf("%d",* (pointer++));
场景3:
int count = 6;
int * pointer = &count ;
printf("%d",* (pointer+1));
这三种场景下 * pointer++,* (pointer++),*(pointer+1)有啥区别?

c
豌豆果果的主页 豌豆果果 | 菜鸟二级 | 园豆:204
提问于:2019-11-14 16:38
< >
分享
所有回答(1)
0

include<stdio.h>

int main(){
int count=6;
printf("count address: %d\n",&count);
int * pointer = &count ;
printf("%d\n",* pointer);
printf("%d %d %d",* pointer++,* (pointer++),* (pointer+1));
}

output:
count address: 2424388
6
2424396 6 2424388
--------------------------------

自己试着把代码敲出来就明白了

monty12 | 园豆:188 (初学一级) | 2019-11-14 21:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册