C Language / Structure Of C Program

The structure of c program consists of 5 sections. They were
Documentation Section
Preprocessor directives Section
Global Declaration Section

Main function Section
{
Declartion Part
Executable Part
}
User defined fucntions Section

Explanation
Section Name Details / Purpose
Documentation It is used to write comments for reference purpose like  creation or modified date, author name etc.It is skipped by the compiler. Example : /* Authoe Name : Wisdom Materials Creation Date : 1/1/2019 Purpose: C language  */
Preprocessor directives Proprocessor directives / macros are statements which are executed before compilation.
Global Declaration Here Global variables are defined and used throughout the entire program.
Main function It contains 2 sections (declaration section and executable section).In Declaration section all the variables are declared and used in the executable section and every line should be separated by a semi colon. The language which uses semi colon as a saparator in the program between lines is called as a free form language.
User defined fucntions Here users define their own functions for a particular task.


1. Write a to Print a statement in c language.
Program Output

/* Hello World program in c Language */
#include <stdio.h>
int main()
{
printf(“Hello World!”);
return 0;
}

Hello World!

Saving, Compilation and Running
Save file with extension .c and file name hw hw.c
Compiling ALT + F9
Running CTRL + F9


Home     Back