請(qǐng)問我的代碼哪里有問題呢?謝謝
include <stdio.h>
/* 考慮一下哪個(gè)輸出該用無參函數(shù)哪個(gè)輸出該用有參函數(shù)呢? */
int test(int o)
{
? ? printf("小明在慕課網(wǎng)上已經(jīng)參與學(xué)習(xí)了%d門課程",o);
}
int main()
{
? ?test(10);
? ? return 0;
}
include <stdio.h>
/* 考慮一下哪個(gè)輸出該用無參函數(shù)哪個(gè)輸出該用有參函數(shù)呢? */
int test(int o)
{
? ? printf("小明在慕課網(wǎng)上已經(jīng)參與學(xué)習(xí)了%d門課程",o);
}
int main()
{
? ?test(10);
? ? return 0;
}
2019-01-25
舉報(bào)
2019-01-25
1、include <stdio.h>前面要加#
2、int test(int o)
{
? ? printf("小明在慕課網(wǎng)上已經(jīng)參與學(xué)習(xí)了%d門課程",o);
}
這部分你用了int就要在末尾寫return 0 ;
還有你的printf中內(nèi)容的逗號(hào)要用英文的逗號(hào)
修改后:
#include <stdio.h>
/* 考慮一下哪個(gè)輸出該用無參函數(shù)哪個(gè)輸出該用有參函數(shù)呢? */
int test(int o)
{
?printf("小明在慕課網(wǎng)上已經(jīng)參與學(xué)習(xí)了%d門課程",o);
??? return 0;
}
int main()
{
??? test(10);
??? return 0;
}
2019-01-25
當(dāng)test函數(shù)返回值不是void時(shí),在主函數(shù)中調(diào)用,需要用一個(gè)變量來接收返回值
或者可以將test函數(shù)的返回值改為void