首页 > 代码库 > 例题9.1

例题9.1

#include<stdio.h>
int main()
{

  struct Student
  {
  
    int num;
    char name[20];
    char sex;
    char addr[20];
 }a={10101,"LI LIN",M,"123 BEIJING ROAD"};
    printf("NO.:%1d\nname:%s\nsex:%cnaddress:%s\n",a.num,a.name,a.sex,a.addr);
    return 0;
}
#include<stdio.h>
int main()
{

  struct Student
  {
  
    int num;
    char name[20];
    char sex;
    char addr[20];
 }a={10101,"LI LIN",M,"123 BEIJING ROAD"};//定义结构体变量,初始化、
    printf("NO.:%1d\nname:%s\nsex:%cnaddress:%s\n",a.num,a.name,a.sex,a.addr);
    return 0;
}

 

 

 

 

NO.:10101
name:LI LIN
sex:Mnaddress:123 BEIJING ROAD

--------------------------------
Process exited after 0.004917 seconds with return value 0
请按任意键继续. . .

例题9.1