i am a beginner, but im interested to know wat about programing... plz help me... tanx... can i get the basic code? send me pls... tanx..

Recommended Answers

All 10 Replies

Ok -- here's the basic code

#include <stdio.h>

int main(int argc, char* argv[])
{
   printf("Hello World\n");
}

You forgot the return statement :)

No I didn't -- the return statement in main() is optional.

Then my bad. I thought it was one of those warnings my borland compiler suppressed. :P

Then my bad. I thought it was one of those warnings my borland compiler suppressed. :P

Yeah!! you are right .. Some compilers show warning on not providing the return statement while using int main()

use void main(void) instead!!!

>>use void main(void) instead!!!

Never ever use void main() because the only return value stated in c and c++ standards is int. main() will return an integer whether you declare it like that or not. Of a return value is not specified then the function will return 0.

If your compiler produces a warning then just add a return statement.

Sorry sir ! ... I just read about it in another forum

use void main(void) instead!!!

You can answer that with a rhetorical question: Would you provide a maniac with a RPG Launcher?
No. Why? Because it's Harmful.

Yeah!! you are right .. Some compilers show warning on not providing the return statement while using int main()

I could very well tick it off of my compilers "Warnings To Suppress" List. But as AncientDragon enlightened me that it's optional, so my current settings are infact right. And BTW the posts are going way off topic so let's just stop here & not force Nick to Lock this thread. ;)

>>And BTW the posts are going way off topic

Not really -- the op didn't ask a reasonable question in the first place.

commented: LMAO! :D +1

^^ Lol! :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.