SlideShare a Scribd company logo
1 of 15
Structure of a C program
1.Documentation section-suggest
2.Preprocessor section/link/header
file-mandatory
3.Definition section-optional
4.Global declaration-optional
5.Main function-mandatory
6.User defined functions/sub
program-optional
Documentation section
• It includes the statement specified at the
beginning of a program, such as a
program's name, date, description, and title. It is
represented as:
ex: //name of a program
• Or
• /*
• Overview of the code
• .
• */
Preprocessor section
• The preprocessor section contains all the
header files used in a program. It informs the
system to link the header files to the system
libraries. It is given by:
• #include<stdio.h> Standard Input Output
• #include<conio.h> console input output
library functions
• # include <math.h>mathematic functions
Functions
• Built-in and user define
• Built in – printf()-o/p function
scanf()-i/p
Define section
• The define section comprises of different
constants declared using the define keyword.
It is given by: symbolic const..
• #define a = 2
• #define PI=3.14
Global declaration
• The global section comprises of all the global
declarations in the program. It is given by:
• Variables two types
• Local and global
Ex: main()
{
Int a=10; local
}
Ex: Int x = 30
main()
{
} Global
{
}
Main function
main() is the first function to be executed by the
computer. It is necessary for a code to include
the main().
Ex: main()
{
Declaration part
Executable part
}
• Ex: main()
• {
• Int a,b,c;
• a=10;
• b=20;
• C=a+b
• }
User defined
functions or sub programs-optional
• The user defined functions specified the
functions specified as per the requirements of
the user. For example, color(), sum(),
division(), etc.
Sample program
• /* Sum of two numbers */ documentations sec..
• #include<stdio.h> link sec..
• int main() global declaration function
• {
• int a, b, sum; local variable section
• printf("Enter two numbers to be added "); Declaration part
• scanf("%d %d", &a, &b);
• sum = a + b; executable part
• printf("%d + %d = %d", a, b, sum);
•
• }
• Output

More Related Content

Similar to Presentation1.pptx

Chap 2 structure of c programming dti2143
Chap 2  structure of c programming dti2143Chap 2  structure of c programming dti2143
Chap 2 structure of c programming dti2143
alish sha
 
object oriented programming part inheritance.pptx
object oriented programming part inheritance.pptxobject oriented programming part inheritance.pptx
object oriented programming part inheritance.pptx
urvashipundir04
 
Basics of c Nisarg Patel
Basics of c Nisarg PatelBasics of c Nisarg Patel
Basics of c Nisarg Patel
TechNGyan
 

Similar to Presentation1.pptx (20)

Introduction of c programming unit-ii ppt
Introduction of  c programming unit-ii pptIntroduction of  c programming unit-ii ppt
Introduction of c programming unit-ii ppt
 
Basics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxBasics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptx
 
5. Functions in C.pdf
5. Functions in C.pdf5. Functions in C.pdf
5. Functions in C.pdf
 
Structure of a C program
Structure of a C programStructure of a C program
Structure of a C program
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
PPs16.pptx
PPs16.pptxPPs16.pptx
PPs16.pptx
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptx
 
Chap 2 structure of c programming dti2143
Chap 2  structure of c programming dti2143Chap 2  structure of c programming dti2143
Chap 2 structure of c programming dti2143
 
Prog1-L1.pdf
Prog1-L1.pdfProg1-L1.pdf
Prog1-L1.pdf
 
Basic Structure of C Language and Related Term
Basic Structure of C Language  and Related TermBasic Structure of C Language  and Related Term
Basic Structure of C Language and Related Term
 
C++ basics
C++ basicsC++ basics
C++ basics
 
Learning the C Language
Learning the C LanguageLearning the C Language
Learning the C Language
 
object oriented programming part inheritance.pptx
object oriented programming part inheritance.pptxobject oriented programming part inheritance.pptx
object oriented programming part inheritance.pptx
 
6 preprocessor macro header
6 preprocessor macro header6 preprocessor macro header
6 preprocessor macro header
 
Csc240 -lecture_3
Csc240  -lecture_3Csc240  -lecture_3
Csc240 -lecture_3
 
Programming in c (importance of c)
Programming in c (importance of c)Programming in c (importance of c)
Programming in c (importance of c)
 
Basics of c Nisarg Patel
Basics of c Nisarg PatelBasics of c Nisarg Patel
Basics of c Nisarg Patel
 
C structure
C structureC structure
C structure
 
Stucture of c program
Stucture of c programStucture of c program
Stucture of c program
 

Recently uploaded

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Recently uploaded (20)

REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 

Presentation1.pptx

  • 1.
  • 2. Structure of a C program
  • 3.
  • 4. 1.Documentation section-suggest 2.Preprocessor section/link/header file-mandatory 3.Definition section-optional 4.Global declaration-optional 5.Main function-mandatory 6.User defined functions/sub program-optional
  • 5. Documentation section • It includes the statement specified at the beginning of a program, such as a program's name, date, description, and title. It is represented as: ex: //name of a program • Or • /* • Overview of the code • . • */
  • 6. Preprocessor section • The preprocessor section contains all the header files used in a program. It informs the system to link the header files to the system libraries. It is given by: • #include<stdio.h> Standard Input Output • #include<conio.h> console input output library functions • # include <math.h>mathematic functions
  • 7. Functions • Built-in and user define • Built in – printf()-o/p function scanf()-i/p
  • 8. Define section • The define section comprises of different constants declared using the define keyword. It is given by: symbolic const.. • #define a = 2 • #define PI=3.14
  • 9. Global declaration • The global section comprises of all the global declarations in the program. It is given by: • Variables two types • Local and global Ex: main() { Int a=10; local }
  • 10. Ex: Int x = 30 main() { } Global { }
  • 11. Main function main() is the first function to be executed by the computer. It is necessary for a code to include the main(). Ex: main() { Declaration part Executable part }
  • 12. • Ex: main() • { • Int a,b,c; • a=10; • b=20; • C=a+b • }
  • 13. User defined functions or sub programs-optional • The user defined functions specified the functions specified as per the requirements of the user. For example, color(), sum(), division(), etc.
  • 14. Sample program • /* Sum of two numbers */ documentations sec.. • #include<stdio.h> link sec.. • int main() global declaration function • { • int a, b, sum; local variable section • printf("Enter two numbers to be added "); Declaration part • scanf("%d %d", &a, &b); • sum = a + b; executable part • printf("%d + %d = %d", a, b, sum); • • }