#include <stdio.h>
#include <stdlib.h>
struct Student
{
	int score;
    char name[128];
};//分号

int main()
{
	struct Student s1;
    s1.score = 99;
    strcpy(s1.name,"张三");
    printf("%s:%d\n",s1.name,s1.score);
    //定义
	struct Student *p;
	//开辟空间
    p = (struct Student *)malloc(sizeof(struct Student));
    p->score = 100;
    strcpy(p->name,"李四");
    //使用
    printf("%s:%d\n",p->name,p->score);
	system("pause");
	return 0;
}

更多推荐