我得到一個奇怪的錯誤,說我的變量沒有被聲明,即使我已經在main中聲明瞭它們。我錯過了什麼嗎?編譯器錯誤變量聲明
錯誤4錯誤C2065:目的地:未聲明的標識符C:\用戶\所有者\文件\視覺工作室2012 \項目\ project36 \ project36 \由source.c 26 1 Project36
我編程C.
變量聲明:
char sourcePiece;
char destination;
函數調用:
askForMove(sourcePiece, destination);
功能高清:
void askForMove(char sourcePiece, char destination) {
char sourcePiece;
char destination;
printf("\nEnter your desired move. First enter the starting position, followed by the ending position in letters: ");
scanf(" %c %c", &sourcePiece, &destination);
}
原型:
void askForMove(char, char);
你能顯示整個代碼嗎? –
是不是你複製char sourcepiece和函數中的目的地。 –
我認爲參數名稱並不重要。他們是不同的,不是嗎?是的,我可以發佈整個代碼。 –