1
我正在使用Windows 10,TDM-GCC和Eclipse NEON開發工具,該工具在點擊運行按鈕後無法執行程序,而且我也看不到任何編譯後引發的錯誤消息。它顯示非執行程序的Windows 10對話框,其中顯示「一個問題導致程序停止正常工作。如果有解決方案,Windows會關閉程序並通知您。」programname.exe在Windows 10中已停止工作對話框
計劃,該計劃我試圖運行 -
#include<stdio.h>
int first;
int second;
int *firstreference;
int *secondreference;
void calledbyvalue(int input);
void calledbyreference(int *input);
void calledbyvalue(int input){
//disabling the buffer
setbuf(stdout, NULL);
printf("Enter the first value - ");
scanf("%d", &input);
printf("Value entered for first is - %d", input);
printf("Entered input is - %d",input);
}
void calledbyreference(int *inputreference){
//disabling the buffer
setbuf(stdout, NULL);
printf("Enter the second value - ");
scanf("%d", &inputreference);
printf("Value entered for second is - %d", inputreference);
printf("Entered input reference value is - %d",&inputreference);
}
void main(){
*firstreference = &first;
*secondreference = &second;
//Calling user defined functions here ....
calledbyvalue(first);
calledbyreference(firstreference);
calledbyvalue(second);
calledbyreference(secondreference);
}
這意味着你的程序崩潰了。您應該在調試器中運行以捕捉崩潰,以查明代碼發生的位置。在調試器中,您還可以檢查變量的值,以幫助您找出可能導致崩潰的原因。 –
你的代碼應該會導致編譯器發出很多警告,如果沒有,那麼你需要改變構建設置。編譯器警告通常與編譯器錯誤同樣嚴重,因爲它們可能表明您執行了錯誤操作,導致*未定義行爲並在運行時崩潰。 –