Basic Structure of a C Program
Overview of the six main sections of a C program, including Documentation, Header Files, Definitions, Global Declarations, Main Function, and Other Functions.
🔥 Related Trending Topics
LIVE TRENDSThis video may be related to current global trending topics. Click any trend to explore more videos about what's hot right now!
THIS VIDEO IS TRENDING!
This video is currently trending in Thailand under the topic 'สภาพอากาศ'.
About this video
#clanguage #cprogramming
Basic Structure of a C Program:-
• A C program is divided into six sections: Documentation, Header File, Definition, Global Declaration, Main( ) Function, and User Defined Functions.
• While the main section is compulsory, the rest are optional in the structure of the C program.
Comment Section or Documentation Section
Header File Section or Preprocessor Directive Section or Linking Section
Definition Section
Global Variable Declaration Section
main( )
{
Declaration Part
Execution Part
}
User_Defined_Function( )
{
Function body
}
1.Comment Section or Documentation Section
• Comments are useful for understanding the program.
• It Consists of the description of the program such as programmer's name, and creation date.
• Comments can be placed anywhere in the program.
• In a C program, single-line comments can be written using two forward slashes i.e., //, and we can create multi-line comments using /* */.
• i.e., Multi line Comment begins with /* and ends with */ (Forward Slash and Asterisk symbol.
• // add.c
• Ex: sum=a+b
• /*add a and b
and store the
result in sum */
• Comments are not compiled and not executed.
2. Header File Section or Preprocessor Directive Section or Linking Section:-
• Any header file is a collection of library functions.
• Ex:- #include stdio.h , #include string.h , #include conio.h
• Library functions are already defined in the compiler.
• printf( ) , scanf( ) functions are available in stdio header file.
• Extension for header file is .h.
• The statements which are executed before compilation are known as pre-processor directives.
• A copy of these header files is inserted into your code before compilation.
• Linker links object code of several library functions to the main program.
3. Definition Section:-
• It is used to define Symbolic Constants or Macros.
• Ex: #define PI 3.14
• Once we declare a Symbolic Constant then it is not possible to change its value.
• If we try to change macro value, then compiler gives error message.
4. Global Variable Declaration Section:-
• Global Variables are used anywhere in the program
• If we declare a variable above main( ) , then it is called as Global Variable.
5.main function( ):-
• Any C Program is a collection of functions.
• Any C Program must contain one function i.e., main function.
• The execution of C Program must always start from main( ).
• main( ) mainly contains 2 parts.
• 1. Declaration Part 2. Execution Part
main( )
{
Declaration Part
Execution Part
}
• During declaration part, we can declare variables.
• Execution part is used for calculations, displaying results.
6.User Defined functions or sub program :-
• The functions which are defined by the user.
• Any function contains a block of statements which performs given task.
#BasicStructureofaCProgram #StructureofCProgram #CProgramStructure
explain the basic structure of c program with an example pdf,
basic structure of c program pdf,
basic structure of c program wikipedia,
structure of c program with example pdf,
basic structure of c program ppt,
structure program for student details in c,
general structure of c program,
basic structure of c++ program
Video Information
Views
31.4K
Total views since publication
Likes
591
User likes and reactions
Duration
16:47
Video length
Published
Feb 6, 2019
Release date
Quality
hd
Video definition
About the Channel
Tags and Topics
This video is tagged with the following topics. Click any tag to explore more related content and discover similar videos:
#C language #C programming #C training #C lectures #computer programming #sudhakar #atchala #computer training #programming languages #CP #sudhakar c language #C Playlist #basics of c program #c program basics #learn c programming #structure of a c program #c program structure #Explain the basic structure of a C Program with Example #c programming #c program #basic structure of c program #C Program Structure #structure
Tags help categorize content and make it easier to find related videos. Browse our collection to discover more content in these categories.