Find us on Google+ How to Write a Program In C - Invatac - Technology Blog

Pages - Menu

Wednesday, 5 September 2012

How to Write a Program In C


If you are a Computer Programmer, you will definitely come across "Hello World" Programs in your life time. Never-mind the languages most of us start our learning process from a new "Hello World" Program. Here too i am not changing normal starting for learning....

As basic structure of C Programs tell, it should contain 


  1. Documentation Part (Optional)
  2. Preprocessor Statement ( we can call it as Header Files)
  3. Global Declaration (If any..)
  4. Main () function
  5. Curly Braces
  6. Local Declaration
  7. Program Statement (optional)
  8. Functions (Optional)
We can discuss about the Basic Structure of C in our later posts.

now we can try to write a "Hello World".C Program using this basic structure.


//Documentation Part
//Author : www.invatac.com
//Preprocessor Statement


#include <stdio.h>
int main(void)
{
printf("\n Hello World \n");
return 0;
}


Now Save this program as helloworld.c

compile and run the program

Result You will get will be :

Hello World



If you are Linux user and don't know to compile your C Program

then Follow this tutorial : Compile C Program in Linux

happy Programming :)

Rahul Babu RAbout Me
I am a computer student looking for make my own name in the field of technology. Please add my to your circles.




No comments:

Post a Comment