Blogger templates

Pages

Wednesday, 1 August 2012

WAP of C Language that calls many Functions

C Function Program

Statement of C Program : This Program prints the Messages or Instructions when different Functions calls: 

#include<stdio.h>

void England();                                      /* Function declaration */
void Australia();                                     /* Function declaration */
void India();                                           /* Function declaration */

int main()
{
printf(" I am in main\n");

England();                                                 /*  Function call */
Australia();                                                /*  Function call */
India();                                                      /* Function call */

return(0);
}

void England()                                             /* Function definition */
{
printf(" I am in England\n");
}

void Australia()                                             /* Function definition */
{
prinf(" I am in Australia\n");
}

void India()                                                   /* Function definition */
{
printf(" I am in India\n");
}

Output:
I am in main
I am in England
I am in Australia
I am in India

Note:  Number of Conclusions drawn from the above Program:
  • A C Program is a collection of one or more Function or you can say A Function is a basic building block of C program.
  • If a C program contain only one Function, then it must be main(), because Program execution always begins with main().
  • In C program, as many number of Functions exist i.e there is no limit on the number of Functions.
  • Control returns to main() after each Function has doing its work or thing.
  • The Program ends, when main() runs out of statements and Function calls.

                                                               

                                                                 That's All

0 comments:

Post a Comment