Structure

 Structure of C

A C program uses a structured approach, including preprocessor directives, function declarations, global variable declarations, and the main function, which manage header files and macros.



/*
 * Documentation
 * File: printDragon.c
 * Author: Musaffar
 * Description: a small program for display progamming Dragon.
 */

#include ❮stdio.h❯   //Header File
int main()	   //Main Function
{
  printf("This is Programming Dragon");
  return 0;
}

----Output:

This is Programming Dragon


  • /*...*/ will be ignored by the compiler and it has been put to add additional comments in the program. So such lines are called comments in the program
  • The 2nd to 5th lines are using for documentation int he above program.
  • The 8th line of the program #include <stdio.h> is a preprocessor command, which tells a C compiler to include stdio.h file before going to actual compilation.
  • The 9th line int main() is the main function where the program execution begins.
  • The 11th line printf(...) is another function available in C which causes the message "This is Programming Dragon" to be displayed on the screen.
  • The next line return 0; terminates the main() function and returns the value 0.

Post a Comment

0 Comments