#include "stdio.h"
int change_by_value(int x)
{
x=x+1;
return x;
}
int change_by_address(int* y)
{
(*y)++;
return *y;
}
void main()
{
int a=10;
printf("a=%d\n",a);
printf("change_by_value=%d\n",change_by_value(a));
printf("a=%d\n",a);
printf("change_by_address=%d\n",change_by_address(&a));
printf("a=%d\n",a);
// printf("a=%d\nchange_by_value=%d\na=%d\nchange_by_address=%d\na=%d\n",a,change_by_value(a),a,change_by_address(&a),a);
}
把上面几个printf的内容放在一起,出现了不同的值,很奇怪~~~