Solved no Error, No Thread but not give OUtput in C

March 27, 2014 at 04:29:04
Specs: Windows XP 7, 2GB
no Error, No Thread but not give OUtput in C
program is here
#inclide<stdio.h>
void main (void)
{
int x,b,c;
x=23;
b=45;
c=x+b;
printf("Addition of Two numbers %d", c)

}


See More: no Error, No Thread but not give OUtput in C

Report •


#1
March 27, 2014 at 05:57:40
Try adding a "\n" after the "%d".

Report •

#2
March 28, 2014 at 13:13:05
✔ Best Answer
The problem is Windows will close the application's console window as soon as it exits. As it just prints a single line and returns, your output flashes by faster than you can see.

There are workarounds.
• The most popular is to use Visual Studio, as running a console program without debugging will keep the console window up. Check to see if your IDE has such a feature, or can emulate it with "cmd /k". If not, consider a better IDE.
• Add a breakpoint before the program's exit. Ideally on main()'s return.
• Just before the program exits, add a line:

system("pause");
• If all else fails, run your program from the Command Prompt.

How To Ask Questions The Smart Way

message edited by Razor2.3


Report •

Related Solutions


Ask Question