标签:std 输出 aaa include void 浅谈 char har 指针
直接上代码
#include<stdio.h>
void a(char a){
a = ‘b‘;
}
void aa(char *a){
char b = ‘b‘;
a = &b;
}
void aaa(char *a){
char b = ‘b‘;
*a = b;
}
int main(){
char c = ‘a‘;
char *cc = &c;
a(c);
printf("%c\n",c);
aa(cc);
printf("%c\n",c);
aaa(cc);
printf("%c\n",c);
}
输出
a
a
b
所以只有一种情况才会真正改变变量的值,
把指针也当成局部变量吧~
标签:std 输出 aaa include void 浅谈 char har 指针
原文地址:http://www.cnblogs.com/zhangfx/p/7728133.html