指针与数组在结构体中的应用(问题)。

#if 1
#include <stdio.h>
#include <string.h>
struct student     //
{
char   *name ;   //if array,it is avaliable. //MEMORY IS NOT HAVE A SKY.若改为数组就好了。
int score;
}stu,*pstu;
int main()
{
//union student stu;    
strcpy(stu.name,"Jimy");
stu.score = 99;
printf("string is %s  ",stu.name);
return 0;
}

error  : 内存没有分配空间给指针变量,初始化内容为空.

猜你喜欢

转载自blog.csdn.net/iyy123IUU/article/details/87975465