My First C Program

My First C Program

Lets write our first C program.


The above image shows our first C program.

the first line says that include the library file stdio.h with this program.
we need to write this line because the basic input and output operations are in this library file only.

printf() is a function that we have used in the fourth line of our code .it is a predefined function which is inside stdio.h file.so in order to use the printf() function we need to include stdio.h library file.

the second line has the main function .as we already know every program show have a main function and the execution starts from the main function only.
The int used before main is a keyword which indicates the return type of the function. it says int so we returned 0 at the end of the code.if returns 0 if the program is executed correctly.

the printf() function prints all the values written with in the double quotes.
\n means new line character .it me if a \n is encountered then the pointer moves to the next line and the content following is printed on the newline.(See the output to get clear picture of it.) 

All the contents of main function should be enclosed with in {.....}

If  you run the above program you get the output as follows.

  

Thank you..

Previous Post
Next Post
Related Posts

0 comments:

Popular Posts