C – Program Structure

Program:

  • C program consists variables and functions.
  • Program execution starts with main() function automatically.

Main.c

#include<stdio.h>
void main()
{
            printf(“Hello”);
}

Application:

  • C application contains more than one program.
  • We connect these programs by calling one program functions from another program.
  • We connect these programs using #include.
  • Only one program contain main() function from which application execution starts.
Main.cArithmetic.c
#include<arithmetic.c>
void main()
{
            // invoking functions
            add();
            subtract();
}
#include<stdio.h>
void add()
{
            printf(“Add”);
}
void subtract()
{
            printf(“Subtract”);
}

#include:

  • A pre-processor directive is used to connect the programs in C application.

Library:

  • Library is a collection of pre-define programs called Header-files.
  • Header-file contains Variables and Methods.
  • Library is used to develop C application quickly.
  • Some of the header file names as follows:
stdio.hmath.hconio.hstring.hgraphics.h
printf()
scanf()
sqrt()
rand()
clrscr()
getch()
strlen()
strrev()
circle()
line()
Scroll to Top