SlideShare a Scribd company logo
6
Most read
8
Most read
9
Most read
Structure of
C Program
Prof. Navya Francis
Asst. Professor
Kristu Jayanti College
Basic Structure Of A C Program
• The basic structure of a C program is divided into 6 parts
which makes it easy to read, modify, document, and
understand in a particular format.
• C program must follow the below-mentioned outline in
order to successfully compile and execute.
• Debugging is easier in a well-structured C program.
Sections of the C Program
There are 6 basic sections responsible for the proper
execution of a program. Sections are mentioned below:
1.Documentation
2.Preprocessor Section
3.Definition
4.Global Declaration
5.Main() Function
6.Sub Programs
1. Documentation
• This section consists of the description of the program, the
name of the program, and the creation date and time of the
program. It is specified at the start of the program in the
form of comments.
• Documentation can be represented as:
or
// description, name of the program, programmer name, date, time etc.
// description, name of the program, programmer name, date, time etc.
// description, name of the program, programmer name, date, time etc.
2. Preprocessor Section
• All the header files of the program will be declared in
the preprocessor section of the program.
• Header files help us to access other’s improved code into
our code.
• A copy of these multiple files is inserted into our program
before the process of compilation.
• Example:
#include <stdio.h>
#include <math.h>
3. Definition
• Preprocessors are the programs that process our source
code before the process of compilation.
• There are multiple steps which are involved in the writing
and execution of the program.
• Preprocessor directives start with the ‘#’ symbol.
• The #define preprocessor is used to create a constant
throughout the program.
• Whenever this name is encountered by the compiler, it is
replaced by the actual piece of defined code.
• Example:
#define long long 11
4. Global Declaration
• The global declaration section contains global variables,
function declaration, and static variables.
• Variables and functions which are declared in this scope can
be used anywhere in the program.
• Example:
Int num=18;
5. Main() Function
• Every C program must have a main function.
• The main() function of the program is written in this section.
• Operations like declaration and execution are performed inside the
curly braces of the main program.
• The return type of the main() function can be int as well as void too.
void() main tells the compiler that the program will not return any
value.
• The int main() tells the compiler that the program will return an integer
value.
• Example:
Void main() or int main()
6. Sub Programs
• User-defined functions are called in this section of the program.
• The control of the program is shifted to the called function
whenever they are called from the main or outside the main()
function.
• These are specified as per the requirements of the programmer.
• Example:
Int sum(int x, int y)
{
Return (x+y);
}
Structure of C Program
#include <stdio.h>
int main() {
printf("Hello C Programmingn");
return 0;
}
THANK YOU
Ad

Recommended

PPs16.pptx
PPs16.pptx
Vamshi171
 
Structure of the C Program.docx
Structure of the C Program.docx
ChristopherHerring9
 
Presentation1.pptx
Presentation1.pptx
pagotimohanrao1
 
Lecture 2
Lecture 2
pranavofcit
 
C PROGRAMMING p-2.pdf
C PROGRAMMING p-2.pdf
D.K.M college for women
 
OVERVIEW OF ‘C’ PROGRAM
OVERVIEW OF ‘C’ PROGRAM
Sahithi Naraparaju
 
Structure
Structure
Daffodil International University
 
Basic structure of c programming
Basic structure of c programming
TejaswiB4
 
Basic structure of c programming
Basic structure of c programming
TejaswiB4
 
1st presentation.pptxajshfjkashfnajsfbasjk
1st presentation.pptxajshfjkashfnajsfbasjk
mahnoor01999
 
C session 1.pptx
C session 1.pptx
NIRMALRAJSCSE20
 
C Programming UNIT 1.pptx
C Programming UNIT 1.pptx
Mugilvannan11
 
Introduction to programming with c,
Introduction to programming with c,
Hossain Md Shakhawat
 
Introduction to Programming Lecture Material 5
Introduction to Programming Lecture Material 5
nazmulabdal
 
C Programming Lecture 2 - Structure of a C Program.pptx
C Programming Lecture 2 - Structure of a C Program.pptx
Murali M
 
Features of 'c' program
Features of 'c' program
veer patel
 
Data Structure Using C.pptx
Data Structure Using C.pptx
ssuser5610081
 
chapter 1.pptx
chapter 1.pptx
SeethaDinesh
 
What is a structure of a c program?
What is a structure of a c program?
Indian Institute of Embedded Systems
 
What is a structure of a 'C' program
What is a structure of a 'C' program
Indian Institute of Embedded Systems
 
Programming In C- (1)jhgjhgjhgjhghj.docx
Programming In C- (1)jhgjhgjhgjhghj.docx
Dpak Chavan
 
Programming Fundamentals and basic knowledge
Programming Fundamentals and basic knowledge
imtiazalijoono
 
C programming languag for cse students
C programming languag for cse students
Abdur Rahim
 
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptx
Vigneshkumar Ponnusamy
 
UNIT 1 NOTES.docx
UNIT 1 NOTES.docx
Revathiparamanathan
 
Programming in c (importance of c)
Programming in c (importance of c)
ViswanathanS21
 
An Overview of Programming C
An Overview of Programming C
Nishargo Nigar
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
Rasan Samarasinghe
 
Data Warehosuing & Data Mining: Apriori Algorithm
Data Warehosuing & Data Mining: Apriori Algorithm
Navya Francis
 
Data Warehosuing & Data Mining: FP Growth
Data Warehosuing & Data Mining: FP Growth
Navya Francis
 

More Related Content

Similar to C Programming: Basic Structure of C Program (20)

Basic structure of c programming
Basic structure of c programming
TejaswiB4
 
1st presentation.pptxajshfjkashfnajsfbasjk
1st presentation.pptxajshfjkashfnajsfbasjk
mahnoor01999
 
C session 1.pptx
C session 1.pptx
NIRMALRAJSCSE20
 
C Programming UNIT 1.pptx
C Programming UNIT 1.pptx
Mugilvannan11
 
Introduction to programming with c,
Introduction to programming with c,
Hossain Md Shakhawat
 
Introduction to Programming Lecture Material 5
Introduction to Programming Lecture Material 5
nazmulabdal
 
C Programming Lecture 2 - Structure of a C Program.pptx
C Programming Lecture 2 - Structure of a C Program.pptx
Murali M
 
Features of 'c' program
Features of 'c' program
veer patel
 
Data Structure Using C.pptx
Data Structure Using C.pptx
ssuser5610081
 
chapter 1.pptx
chapter 1.pptx
SeethaDinesh
 
What is a structure of a c program?
What is a structure of a c program?
Indian Institute of Embedded Systems
 
What is a structure of a 'C' program
What is a structure of a 'C' program
Indian Institute of Embedded Systems
 
Programming In C- (1)jhgjhgjhgjhghj.docx
Programming In C- (1)jhgjhgjhgjhghj.docx
Dpak Chavan
 
Programming Fundamentals and basic knowledge
Programming Fundamentals and basic knowledge
imtiazalijoono
 
C programming languag for cse students
C programming languag for cse students
Abdur Rahim
 
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptx
Vigneshkumar Ponnusamy
 
UNIT 1 NOTES.docx
UNIT 1 NOTES.docx
Revathiparamanathan
 
Programming in c (importance of c)
Programming in c (importance of c)
ViswanathanS21
 
An Overview of Programming C
An Overview of Programming C
Nishargo Nigar
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
Rasan Samarasinghe
 
Basic structure of c programming
Basic structure of c programming
TejaswiB4
 
1st presentation.pptxajshfjkashfnajsfbasjk
1st presentation.pptxajshfjkashfnajsfbasjk
mahnoor01999
 
C Programming UNIT 1.pptx
C Programming UNIT 1.pptx
Mugilvannan11
 
Introduction to programming with c,
Introduction to programming with c,
Hossain Md Shakhawat
 
Introduction to Programming Lecture Material 5
Introduction to Programming Lecture Material 5
nazmulabdal
 
C Programming Lecture 2 - Structure of a C Program.pptx
C Programming Lecture 2 - Structure of a C Program.pptx
Murali M
 
Features of 'c' program
Features of 'c' program
veer patel
 
Data Structure Using C.pptx
Data Structure Using C.pptx
ssuser5610081
 
Programming In C- (1)jhgjhgjhgjhghj.docx
Programming In C- (1)jhgjhgjhgjhghj.docx
Dpak Chavan
 
Programming Fundamentals and basic knowledge
Programming Fundamentals and basic knowledge
imtiazalijoono
 
C programming languag for cse students
C programming languag for cse students
Abdur Rahim
 
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptx
Vigneshkumar Ponnusamy
 
Programming in c (importance of c)
Programming in c (importance of c)
ViswanathanS21
 
An Overview of Programming C
An Overview of Programming C
Nishargo Nigar
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
Rasan Samarasinghe
 

More from Navya Francis (11)

Data Warehosuing & Data Mining: Apriori Algorithm
Data Warehosuing & Data Mining: Apriori Algorithm
Navya Francis
 
Data Warehosuing & Data Mining: FP Growth
Data Warehosuing & Data Mining: FP Growth
Navya Francis
 
C Programming: Looping Statements in C Pgm
C Programming: Looping Statements in C Pgm
Navya Francis
 
C Programming: Control Statements in C Pgm
C Programming: Control Statements in C Pgm
Navya Francis
 
Data Warehousing & Data Mining: Introduction
Data Warehousing & Data Mining: Introduction
Navya Francis
 
Data Structures: Introduction to Data Structures
Data Structures: Introduction to Data Structures
Navya Francis
 
JAVA Programming : Topic JAVA Programming Swing
JAVA Programming : Topic JAVA Programming Swing
Navya Francis
 
JAVA Programming: Topic -AWT(Abstract Window Tool )
JAVA Programming: Topic -AWT(Abstract Window Tool )
Navya Francis
 
Data Structures: Classification of Data Structures
Data Structures: Classification of Data Structures
Navya Francis
 
Software Engineering Topic: Risk Management
Software Engineering Topic: Risk Management
Navya Francis
 
Software Engineering: Topic: Waterfall Model
Software Engineering: Topic: Waterfall Model
Navya Francis
 
Data Warehosuing & Data Mining: Apriori Algorithm
Data Warehosuing & Data Mining: Apriori Algorithm
Navya Francis
 
Data Warehosuing & Data Mining: FP Growth
Data Warehosuing & Data Mining: FP Growth
Navya Francis
 
C Programming: Looping Statements in C Pgm
C Programming: Looping Statements in C Pgm
Navya Francis
 
C Programming: Control Statements in C Pgm
C Programming: Control Statements in C Pgm
Navya Francis
 
Data Warehousing & Data Mining: Introduction
Data Warehousing & Data Mining: Introduction
Navya Francis
 
Data Structures: Introduction to Data Structures
Data Structures: Introduction to Data Structures
Navya Francis
 
JAVA Programming : Topic JAVA Programming Swing
JAVA Programming : Topic JAVA Programming Swing
Navya Francis
 
JAVA Programming: Topic -AWT(Abstract Window Tool )
JAVA Programming: Topic -AWT(Abstract Window Tool )
Navya Francis
 
Data Structures: Classification of Data Structures
Data Structures: Classification of Data Structures
Navya Francis
 
Software Engineering Topic: Risk Management
Software Engineering Topic: Risk Management
Navya Francis
 
Software Engineering: Topic: Waterfall Model
Software Engineering: Topic: Waterfall Model
Navya Francis
 
Ad

Recently uploaded (20)

OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
parmarjuli1412
 
How payment terms are configured in Odoo 18
How payment terms are configured in Odoo 18
Celine George
 
Photo chemistry Power Point Presentation
Photo chemistry Power Point Presentation
mprpgcwa2024
 
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
Kweku Zurek
 
How to Add New Item in CogMenu in Odoo 18
How to Add New Item in CogMenu in Odoo 18
Celine George
 
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
HistoPathology Ppt. Arshita Gupta for Diploma
HistoPathology Ppt. Arshita Gupta for Diploma
arshitagupta674
 
Q1_TLE 8_Week 1- Day 1 tools and equipment
Q1_TLE 8_Week 1- Day 1 tools and equipment
clairenotado3
 
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
Ronisha Das
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
NSUMD_M1 Library Orientation_June 11, 2025.pptx
NSUMD_M1 Library Orientation_June 11, 2025.pptx
Julie Sarpy
 
Code Profiling in Odoo 18 - Odoo 18 Slides
Code Profiling in Odoo 18 - Odoo 18 Slides
Celine George
 
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
SHERAZ AHMAD LONE
 
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
mprpgcwa2024
 
Peer Teaching Observations During School Internship
Peer Teaching Observations During School Internship
AjayaMohanty7
 
Values Education 10 Quarter 1 Module .pptx
Values Education 10 Quarter 1 Module .pptx
JBPafin
 
Wage and Salary Computation.ppt.......,x
Wage and Salary Computation.ppt.......,x
JosalitoPalacio
 
Gladiolous Cultivation practices by AKL.pdf
Gladiolous Cultivation practices by AKL.pdf
kushallamichhame
 
2025 Completing the Pre-SET Plan Form.pptx
2025 Completing the Pre-SET Plan Form.pptx
mansk2
 
VCE Literature Section A Exam Response Guide
VCE Literature Section A Exam Response Guide
jpinnuck
 
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
parmarjuli1412
 
How payment terms are configured in Odoo 18
How payment terms are configured in Odoo 18
Celine George
 
Photo chemistry Power Point Presentation
Photo chemistry Power Point Presentation
mprpgcwa2024
 
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
Kweku Zurek
 
How to Add New Item in CogMenu in Odoo 18
How to Add New Item in CogMenu in Odoo 18
Celine George
 
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
HistoPathology Ppt. Arshita Gupta for Diploma
HistoPathology Ppt. Arshita Gupta for Diploma
arshitagupta674
 
Q1_TLE 8_Week 1- Day 1 tools and equipment
Q1_TLE 8_Week 1- Day 1 tools and equipment
clairenotado3
 
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
Ronisha Das
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
NSUMD_M1 Library Orientation_June 11, 2025.pptx
NSUMD_M1 Library Orientation_June 11, 2025.pptx
Julie Sarpy
 
Code Profiling in Odoo 18 - Odoo 18 Slides
Code Profiling in Odoo 18 - Odoo 18 Slides
Celine George
 
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
SHERAZ AHMAD LONE
 
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
mprpgcwa2024
 
Peer Teaching Observations During School Internship
Peer Teaching Observations During School Internship
AjayaMohanty7
 
Values Education 10 Quarter 1 Module .pptx
Values Education 10 Quarter 1 Module .pptx
JBPafin
 
Wage and Salary Computation.ppt.......,x
Wage and Salary Computation.ppt.......,x
JosalitoPalacio
 
Gladiolous Cultivation practices by AKL.pdf
Gladiolous Cultivation practices by AKL.pdf
kushallamichhame
 
2025 Completing the Pre-SET Plan Form.pptx
2025 Completing the Pre-SET Plan Form.pptx
mansk2
 
VCE Literature Section A Exam Response Guide
VCE Literature Section A Exam Response Guide
jpinnuck
 
Ad

C Programming: Basic Structure of C Program

  • 1. Structure of C Program Prof. Navya Francis Asst. Professor Kristu Jayanti College
  • 2. Basic Structure Of A C Program • The basic structure of a C program is divided into 6 parts which makes it easy to read, modify, document, and understand in a particular format. • C program must follow the below-mentioned outline in order to successfully compile and execute. • Debugging is easier in a well-structured C program.
  • 3. Sections of the C Program There are 6 basic sections responsible for the proper execution of a program. Sections are mentioned below: 1.Documentation 2.Preprocessor Section 3.Definition 4.Global Declaration 5.Main() Function 6.Sub Programs
  • 4. 1. Documentation • This section consists of the description of the program, the name of the program, and the creation date and time of the program. It is specified at the start of the program in the form of comments. • Documentation can be represented as: or // description, name of the program, programmer name, date, time etc. // description, name of the program, programmer name, date, time etc. // description, name of the program, programmer name, date, time etc.
  • 5. 2. Preprocessor Section • All the header files of the program will be declared in the preprocessor section of the program. • Header files help us to access other’s improved code into our code. • A copy of these multiple files is inserted into our program before the process of compilation. • Example: #include <stdio.h> #include <math.h>
  • 6. 3. Definition • Preprocessors are the programs that process our source code before the process of compilation. • There are multiple steps which are involved in the writing and execution of the program. • Preprocessor directives start with the ‘#’ symbol. • The #define preprocessor is used to create a constant throughout the program. • Whenever this name is encountered by the compiler, it is replaced by the actual piece of defined code. • Example: #define long long 11
  • 7. 4. Global Declaration • The global declaration section contains global variables, function declaration, and static variables. • Variables and functions which are declared in this scope can be used anywhere in the program. • Example: Int num=18;
  • 8. 5. Main() Function • Every C program must have a main function. • The main() function of the program is written in this section. • Operations like declaration and execution are performed inside the curly braces of the main program. • The return type of the main() function can be int as well as void too. void() main tells the compiler that the program will not return any value. • The int main() tells the compiler that the program will return an integer value. • Example: Void main() or int main()
  • 9. 6. Sub Programs • User-defined functions are called in this section of the program. • The control of the program is shifted to the called function whenever they are called from the main or outside the main() function. • These are specified as per the requirements of the programmer. • Example: Int sum(int x, int y) { Return (x+y); }
  • 10. Structure of C Program #include <stdio.h> int main() { printf("Hello C Programmingn"); return 0; }