Categories
b. Structure of C programming

Basic Structure of C Program

The components of the basic structure of a C program consists of 7 parts

  1. Document section
  2. Preprocessor/link Section
  3. Definition section
  4. Global declaration section
  5. Function declaration section
  6. Main function
  7. User-defined function section

/*
Documentation section
C programming structure
Author: DataFlair
*/
#include <stdio.h> /* Link section */
int subtract = 0; /* Global declaration, definition section */
int all (int, int); /* Function declaration section */
int main () /* Main function */
{

printf("Welcome to DataFlair tutorials!\n\n");

printf ("This is a C program \n");
subtract= all (25,10);
printf ("Subtraction of the two numbers : %d \n", subtract);
return 0;
}
int all (int x, int y) /* User defined function */
{ 
return x-y; /* definition section */
}

Code on Screen-

Output

Leave a Reply

Your email address will not be published. Required fields are marked *