Wednesday, September 18, 2013

Dissecting The Program

The program in the last post is very simple , consisting  just few lines of C code . But it is very important to understand this as it serves as the foundation for larger programs. As they say " Journey Of A Thousand Miles Begins With A Single Step ".
Let's look at the program line by line .


#include<stdio.h>

The Header of the program is very necessary if you want to use the printf statement . Without this line the printf statement won't work.  We will  look at it in detail later when we are writing our own libraries. As of now all we need to know is the printf statement is declared in the stdio.h library and stdio.h stands for Standard Input Output Header. Some other libraries are conio.h , math.h (Just remember the names for now)

 void main ()     
    {
    }

This is the Main part of the program . If you are given a task to do something you need to know how to start the task right?? Similarly main is used so that the computer can know from where it has to start executing the program. The computer executes whatever is inside the Main function`s body.The body of the main function is defined by the curly braces {  } .
printf ("Hello World");

This is the line that prints Hello World onto the screen . We will be using this function more than any other function (Trust Me) 

So thats it lets get started with a few practical aspects from the next post .








No comments:

Post a Comment