如果您無法通過我爲您制定的高級代碼分辨出來,那麼我是新編程的。我正在閱讀一本關於C編程的書,我將這些代碼作爲一個練習複製出來,我不知道爲什麼我會得到我的錯誤。請幫忙!!!對「calcyear」的未定義引用
我得到,指出"file: main.c" "message: undefined reference to calcyear"
/*bigyear.c*/
#include <stdio.h>
#define TARGET_AGE 88
int year1, year2;
int calcYear(int year1);
int main(void)
{
printf("What year was the subject born?");
printf("Enter as a four digit year (YYYY):");
scanf("%d", &year1);
/*calculate the future year and display it*/
year2 = calcYear(year1);
printf("someone born in %d will be %d in %d.", year1, TARGET_AGE, year2);
return 0;
int calcYear(int year1)
{
return(year1+TARGET_AGE);
}
}
移動定義另一個函數中的一個函數的最後'}'到緊隨'返回0'行。投票結束爲錯字。 – dasblinkenlight
你的複製技能很差:) –
我的觀察技能顯然更低...... – gdubs