结构体指针

来源:互联网 发布:use it or lose it 编辑:程序博客网 时间:2024/06/13 21:54
#include"stdio.h"#error ""struct student{    int code;    char name[10];    char sex[3];    int age;}stu;main(){    struct student *s;    s=&stu;    printf("学号、姓名、性别、年龄:");    scanf("%d %s %s %d",&(s->code),s->name,s->sex,&(s->age));    printf("%d %s %s %d",(*s).code,s->name,s->sex,(s->age));}

0 0