<span style="font-size:18px;">//通过指针改变变量的值</span>
/* Note:Your choice is C IDE */
#include "stdio.h"
main()
{
int i;
int *p=&i;
i=3;
printf("i=%d\n",i);
*p=4;
printf("i=%d\n",i);
}
<span style="font-size:18px;">//也许是这个编译器的问题吧,它居然能正常运行</span>
<pre name="code" class="cpp"><pre name="code" class="cpp">/* Note:Your choice is C IDE */
#include "stdio.h"
main()
{ int *p;
*p=4;
printf("*p=%d\n",*p);
}
//申请内存
/* Note:Your choice is C IDE */
#include "stdio.h"
#include "stdlib.h"
main()
{ int *p;
p=(int *)malloc(sizeof(int));
*p=4;
printf("*p=%d\n",*p);
free(p);
}