・独学で勉強中(趣味程度) linux14.04LTS メモ帳で作成
・何度書き直しても同じエラーが出る
・コード
#include <stdio.h>
int main(void)
{
struct TEST{
int figure;
short value;
char letter;
};
TEST test;
test.figure=100;
test.value=200;
test.letter='A';
printf("%d\n",test.figure);
printf("%d\n",test.value);
printf("%c\n",test.letter);
return 0;
}
・エラー
study01.c: In function ‘main’:
study01.c:9:2: error: unknown type name ‘TEST’
TEST test;
^
study01.c:11:6: error: request for member ‘figure’ in something not a structure or union
test.figure=100;
^
study01.c:12:6: error: request for member ‘value’ in something not a structure or union
test.value=200;
^
study01.c:13:6: error: request for member ‘letter’ in something not a structure or union
test.letter='A';
^
study01.c:15:20: error: request for member ‘figure’ in something not a structure or union
printf("%d\n",test.figure);
^
study01.c:16:20: error: request for member ‘value’ in something not a structure or union
printf("%d\n",test.value);
^
study01.c:17:20: error: request for member ‘letter’ in something not a structure or union
printf("%c\n",test.letter);
^