Created
June 17, 2013 08:31
-
-
Save NaokiKuzumi/5795458 to your computer and use it in GitHub Desktop.
関数の宣言func(void)とfunc()は厳密に違う。
引数のない関数を宣言するのはfunc(void)でなければならない。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void hoge(){ | |
} | |
void fuga(void){ | |
} | |
int main(void){ | |
hoge("piyo"); | |
fuga("java"); | |
return 0; | |
} | |
/* | |
$ gcc -Wall tmp.c | |
tmp.c: 関数 ‘main’ 内: | |
tmp.c:9:2: エラー: 関数 ‘fuga’ への引数が多すぎます | |
tmp.c:4:6: 備考: ここで宣言されています | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment