我想获取包含学生姓名,卷号,并打印 我使用结构,但代码不工作一个数组,其中包含不同数据类型的多个元素
#include<stdio.h>
#include <string.h>
int size,i,j;
struct Student
{
char name[50];
int number;
};
typedef struct Student info1;
info1 print[100];
int main()
{
printf("Size of class : ");
scanf("%d",&size);
for(j=0;j<(20);)
{
for(i=1;i<=size;i++)
{
printf("%d.Name:",i);
scanf("%s",&info1.name);// i get an error here that an exp is expected
print[j]=info1.name; // i get an error here that an exp is expected
j++;
printf("Rollno:");
scanf("%d", &info1.number);// i get an error here that an exp is expected
print[j]=info1.number;// i get an error here that an exp is expected
}
}
for (j = 0;j <(20);)
{
printf("%s Name", print[j]);
j++;
printf("%d Rollno", print[j]);
}
return 0;
}
在调试时我收到以下错误:
前INFO1