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 .








Monday, September 16, 2013

A Very Simple C Program

Now lets take a look  at a very small and simple C program.
Compare this to the structure we have discussed before so that it will be easier to understand , as all C programs will follow the same structure.
#include <stdio.h>              // This is the header of the program
void main ()                       // The main function of the program
{
printf ("Hello World");      /*A simple inbuilt function to print things onto the screen. */
}

UPDATE !!!!

Hi Everyone
We Will Resume The Normal Operation Of The Blog Soon. So Please Keep Checking Regularly
Please Do Comment If You Find The Blog Helpful.





Monday, August 15, 2011

Continuation Of Structure Of A C Program

Ok So Let Me Explain About The First Line In The Structure Of C Program From The Previous Pic .
The First Line Is The Documentation Section
To Exactly Understand What It Is We Need To Understand Another Topic Comments
So What Is A Comment In C ?
It Is Something That Does Not Affect The Running Of The Program
It Is For The Programmer`s Understanding Comments Are Used .
There Are Two Ways To Comment In C
1>Single Line Comment // This Is A Single Line Comment
2>Bock Comment /* The Comment Goes In Here */

A Single Line Comment Is Used When The Comment Is Short .It Is Valid For Only One Line . If The Comment Is Big Its Better To Use A Block Comment , Unlike Single Line Comment Block Comment Can Be Used For Many Lines Together . Unless We Remember To Close Where The Comment Ends . In Single Line Comment There Is No Need TO Specify Where The Comment Ends.


Documentation : So These Are Just Comments That Specify About The Program . Like Who Is The Author, The Date The Program Was Created , The Version Of Program Etc Etc .
They Do Not Interfere With The Running Of Program And Neither Are They Visible When Programming Is Running . The Compiler Does Not Do Anything With The Comment . (Will Talk More About Compiler After Structure)..

Saturday, August 13, 2011

Structure Of C

Welcome Back ,
In This Post Let Us Look At Structure (Format) Of C Language.
When Writing A Letter We Follow Some Procedure.
Lets Take A Look At It








The Same Way For C We Have A Structure/Format

Take A Look At This Pic





This Is The Structure Of C . Will Continue About It In The Next Post.

Sorry Folks

Was A Little Busy .... So Lets Continue From Where We Left Off From The Next Post .

Sunday, January 16, 2011

Sorry

This Blog Will Be Updated Soon.