A few days back I installed Eclipse ide and also the CDT plugin therein for C and C++ development. Also made the necessary settings. Also tried a simple C program of adding two integers. Surprisingly, no output was shown in the terminal, but when the program was terminated it showed a wrong output of 0
.
The program was this:
#include <stdio.h>
int main(){
int a, b;
printf("Enter an integer: "); scanf("%d", &a);
printf("Enter another integer: "); scanf("%d", &b);
printf("Sum = %d", (a+b));
return 0;
}
This same program showed the correct output when it was ran using the command prompt:
gcc -g add.c -o add.exe
Have I made any mistake in the code? Can anyone suggest me what do I need to do to run it in Wclipse?