Let’s start our C First Program through telling you basics about C language. Each and every coding line has its meaning and significance this tutorial will tell you about the simple things along with their syntax.

Let’s start with C First Program :

void main()
  printf("\nWelcome to Buffercode \n");

For gcc complier:

int main()
  printf("\nWelcome to Buffercode \n");
  return 0;

Welcome to Buffercode

SEE ALSO : Why Rails ? An Introduction to my favorite framework

NOTE : The function void main() won’t run over gcc complier as it doesn’t accept void value but compilers like visual compiler , tc++, etc would support void. Along with the change in int main() in replace of void main() also write return 0; at last before ending the brackets.

Now we will go line by line:

  1. #include<stdio.h>
    ‘#’ –> it is called hash.  It is used in C programming language for special keywords that can be processed by the C preprocessor. You will learn more about C Processor in our next tutorials.
  2. include –it simply stands for English meaning ‘to include’.
  3. <stdio.h> -there are predefined function in computer library which have some tasks and function stored inside. Few of the header files are: stdio,math, conio(for visual and tc),stdlib, dos ,string etc.
  4. #include<stdio.h>- this line would include whole ‘stdio.h’ header file in program along with its function.
  5. void main()/int main()
    it’s the main function as name suggest. compiler will just search this line and will start its compiling from main() function.
  6. printf(“Welcome to Buffercode”);
    it’s the output statement. It has two syntax:
    2.printf(“string format”, string name);
  7. {
    The curly brackets are used for separating the different blocks inside the program. The indentation and clarity are preferred for every program.

Next step is to compile the you first C-Program. Click here to learn how to compile on linux, for windows click here.

Do you have something to add or stuck somewhere in C First Program? Please share in comments.

 Follow us on Facebook, Google Plus and Twitter to get more tutorials.

Previous                                      C Programming                                      Next