【C语言】定义指针变量并将其初始化为NULL
案例:
#include
int main(){
int a=0,b=3;
char c='C';
int* pa=NULL,pb=NULL;
char* pc=NULL;
printf("a is %d, &a is %p, pa is %p/n",a,&a,pa);
printf("b is %d, &b is %p, pb is %p/n",b,&b,pb);
printf("c is %c, &c is %p, pc is %p/n",c,&c,pc);
}
输出:
其中,NULL 是一个在 stdio.h 中定义为零值的宏。
共有 0 条评论