/* Note:Your choice is C IDE */
#include "stdio.h"
#include "string.h"
/*define a struct type */
struct student {
int no;
int age; /*结构体类型的定义*/
int score;
};
main()
{
int i;
int age[3]={17,18,19};
int *pi;
struct student info13[45];
struct student *stu;
pi=ages;
stu=info13;
printf("%d\n",ages[1]);
printf("%d\n",*(pi+1));
for(i=0;i<45;i++){
info13[i].no=i+1;
info13[i].age=ages[i%3];
}
printf("no1: %d\n",info13[0].no);
printf("no1: %d\n",(*stu).no);
printf("no1: %d\n",stu-> no);
}
/* Note:Your choice is C IDE */
#include "stdio.h"
#include "string.h"
/*define a struct type */
struct student {
int no;
int age; /*结构体类型的定义*/
int score;
};
main()
{
int i;
int age[3]={17,18,19};
struct student info13[45];
for(i=0;i<45;i++){
info13[i].no=i+1;
info13[i].age=ages[i%3];
}
for(i=0;i<45;I++){
printf("%d-no:%d-age:%d\n",i,info13[i].no,info13[i].age);
}
/* Note:Your choice is C IDE */
#include "stdio.h"
#include "string.h"
/*define a struct type */
struct student {
int no;
int age; /*结构体类型的定义*/
int score;
};
main()
{
struct student cc; /*变量的定义*/
cc.no=20;
cc.age=19; /*变量的赋值*/
cc.score=100;
printf("cc: %d %d %d \n",cc.no,cc.age,cc.score);
}