動きません。
どうしたらよいですか?
教えてください。
#include <stdio.h> #define N 10 #define swap(x,y) {int tmp = x; x = y; y = tmp;} struct student { int num; char name[10]; int score; }; struct student St[] = {{1,"Ichi",90}, {2,"Ni",70}, {3,"San",80}, {4,"Yon",60}, {5,"Go",30}, {6,"Roku",40}, {7,"Nana",100}, {8,"Hati",20}, {9,"Kyuu",10}, {10,"Zyuu",50}}; void out (int St[]){ int i; for(i=0; i<N; i++) printf("%d", St[i].score); putchar('\n'); } int main(){ out(St); } main.c: In function 'out': main.c:25:40: error: request for member 'score' in something not a structure or union for(i=0; i<N; i++) printf("%d", St[i].score); ^ main.c: In function 'main': main.c:30:6: warning: passing argument 1 of 'out' from incompatible pointer type [-Wincompatible-pointer-types] out(St); ^~ main.c:23:6: note: expected 'int *' but argument is of type 'struct student *' void out (int St[]){ ^~~ exit status 1
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/12/02 17:38
2017/12/02 17:45
2017/12/02 17:56
2017/12/02 18:09
2017/12/02 19:14