hi,
How do I compile the following c program in vc++ and run it so that I can see the printf function.
#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
void main(void)
{
printf("Hello world");
}
hi,
How do I compile the following c program in vc++ and run it so that I can see the printf function.
#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
void main(void)
{
printf("Hello world");
}
1. don't use conio.h
2. use int main
3. read FAQ http://faq.cprogramming.com/cgi-bin/...&id=1043284385
Code:#include <stdio.h> int main(void) { printf("Hello, world!\n"); getchar(); return 0; }
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
I doubt you will need the preciompiled header stdafx, so disable it by clicking on project options / C++ / precompiled headers / click "not using precompiled headers".
Please note the above is rthe procedure using MSVC++2003 but it should work on all versions the same way
Double Helix STL
Hi,
Thanks for the help , but the screen does not print " hello world" and I get the message " Press any key".
What's your latest code?
Do you see any error messages when compiling?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
No error messages, I posted the code provided by vart, also does build
creates an exe file , and where it is stored.
Are you sure you created a "win32 console" project?
If you know where the executable is stored, then open a console window and type "CD \path" (where \path is where your executable is), then try running your executable from the command line (by typing in its name)
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.