#include
#include
struct book{
char *name;
int num;
};
int main()
{
struct book bk;
bk = (struct book)malloc(sizeof(struct book));
if(!bk)
{
printf("no space for malloc\n");
return 0;
}
scanf("%s",bk->name); /*此处显示:段错误*/
printf("%s\n",bk->name);
free(bk);
return 0;
}