有參,無參問題
#include <stdio.h>
/* 考慮一下哪個輸出該用無參函數(shù)哪個輸出該用有參函數(shù)呢? */
int learning()
{
? ? printf("小明在慕課網(wǎng)上學(xué)習(xí)");
}
int test( int n)
{
? ? printf("小明已經(jīng)在慕課網(wǎng)上學(xué)習(xí)了%d門課程",n);
}
int main()
{
? ? learning();
? ? test(3);
? ? return 0;
}
代碼哪里錯了啊
2018-02-11
..........你逗號用的是中文輸入法的,換成英文輸入法的逗號就成功了。
2018-02-06
000
2018-02-05
hello.c: In function 'test':
hello.c:11:61: error: stray '\357' in program
? ? printf("小明已經(jīng)在慕課網(wǎng)上學(xué)習(xí)了%d門課程",n);
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ^
hello.c:11:62: error: stray '\274' in program
? ? printf("小明已經(jīng)在慕課網(wǎng)上學(xué)習(xí)了%d門課程",n);
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^
hello.c:11:63: error: stray '\214' in program
? ? printf("小明已經(jīng)在慕課網(wǎng)上學(xué)習(xí)了%d門課程",n);
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ^
hello.c:11:64: error: expected ')' before 'n'
? ? printf("小明已經(jīng)在慕課網(wǎng)上學(xué)習(xí)了%d門課程",n);
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^
hello.c:11:50: warning: format '%d' expects a matching 'int' argument [-Wformat=]
? ? printf("小明已經(jīng)在慕課網(wǎng)上學(xué)習(xí)了%d門課程",n