用字符來就不行了么?什么問題呢?
#include <stdio.h>
#include <stdlib.h>
struct student {
??? char name;
??? char gender;
??? struct student *next
};
int main()
{
??? struct student a,b,c, *head;
??? a.name="xiong";
??? a.gender="boy";
??? b.name="ye";
??? b.gender="boy";
??? c.name="du";
??? c.gender="girl";
??? head=&a;
??? a.next=&b;
??? b.next=&c;
??? c.next=NULL;
??? struct student *p;
??? p=head;
??? while(p!=NULL)
??? {
??????? printf("%s\n%s\n",p->name,p->gender);
??????? p=p->next;
??? }
??? printf("pause");
??? printf("Hello world!\n");
??? return 0;
}
2019-03-01
char name 根本放不了"xiong",溢出了都。 char 單字節,只能放一個byte