Saturday, 7 November 2015

BASIC STRUCTURE OF C PROGRAM 2

MAIN FUNCTION SECTION


  • All the C program contains one or more functions but, there must always be one main() 
  • Execution of every C program begins from the function main() 
  • This section contains 2 parts :

  1. Declaration part - Declares all the variables used in the executable part.
  2. Executable part

  • These two parts must be within the opening and closing braces ({ and })
  • Program execution starts from the opening brace and ends at the closing brace
  • All the statements in the declaration part & executable part must end with a semicolon


SUB - PROGRAM SECTION


  • This section contains the user defined functions.
  • These functions are invoked in the main function.
  • We can have any number of our own functions
  • These functions are generally placed after the main function, although they may appear in any order.
  • These functions are executed only when we invoke these functions



No comments:

Post a Comment