Search This Blog


simple c program example with explanation

C Basic Program with explanation

Comment in C programming  
Comment are used to write some notes in a program .It doesn't have any meaning to compiler. it is used provide information to the programmer about program.

Their are two types of comment are used 
1. Single line Comment :  as shown in example 
 // we are going to use double forward slash.
2. Multi line Comment:  as shown in example  
/* we are going to use */.
Lets we Start with our C basic program and understand  basic parts of c program  as shown  I have divided c program in different parts  as we familiar with the comment in "C " programming

Lets We learn Step By Step
a) example of multi line comment.

b) Header file Declaration: In this section we are going to declare header file /preprocessor directives . header files are source which contain basic libraries .declaring header file in our program means we are going to access basic libraries in that file in our program.
example. in program we have used printf("your message") function it only works when you have declare #include  line in your program. if you don't program give error.
there are number of header file which provide different function for us to execute our program.

c) void main( ): main( ) is system define function. program execution always start from here.It is starting point of our program. c program always contain main() function.

void it is return type we cover it later on . it means function is not going to return anything.

d) starting of function :{  it is actual start of program we are going to write code in between { your code }

e)example of multi line comment.

f) statements separated by semicolon : its series of statement separated by semicolon as we know semicolon means end of statement.

c) }: End of function.

 Type This program use TCC ,compile and run use Cnt+F9 short cut to run the program.

Display output on screen add getch(); in above program , save it and prese  Cnt+F9  

C Program example List

Google+ Badge