SlideShare a Scribd company logo
OUTCOMES: 
Student should be able to: 
0Explain the general form 0f C 
structure 
0Write, Compile & Execute of C 
programme 
2
The general form of C 
programme 
3
Follow 3 steps: 
0 Enter the programme 
0 Compile the programme 
0 Run the programme 
2 terms: 
0 Source code – the human readable form of the 
programme. It is stored in a text file 
0 Object code – the executable form of the programme 
created by a compiler 
4
Write the general form of C 
programme 
0 Entering the programme 
The name of the file that holds the source code for the 
programme is technically arbitrary 
C programme are normally contained in files that use 
the file extension (.cpp) 
5
0 Compiling the programme 
You can compile your .cpp file depends on your 
compiler & what option you are using 
e.g: 
Microsoft Visual C++ Express Edition  provide 2 
different ways of compiling a programme: the 
command-line compiler & the Integrated Development 
Environment (IDE) 
6
0 Execute the debugged programme 
After a C programme has been compiled, it is ready to 
be run 
Since the output from a C compiler is executed object 
code, to run the programme, simply enter its name at 
the command prompt 
7
Pre-processor directives and 
header files 
0 Pre-processor 
Is the directive to enables the programme to use certain 
function contained in the external file such as <stdio.h> 
0 Header file 
Contain specific functions that used to accomplish the 
programming task 
e.g: ctype.h, math.h 
8
#include 
0 replaces by the whole content of specified file 
0 2 ways to specify a file: 
9 
#include “stdio.h” 
the file is looked for from the same directory in which the file 
that includes the directive is 
#include <stdio.h> 
the file is directly looked for in the default directories where 
the compiler is configured to look for standard header files
serves to generate define constants or macros 
10 
#define 
#define variable_name value 
#define pepsi 2.50 
#define grapes 8.50 
Example:
Create block {…} in Main 
function 
a function is a block of statements that is part of large 
programmes 
0 Function main ( ) 
Must have at least the function main ( ) 
Must have a body enclosed in braces { } 
11
0 Function block { } 
the function body  called block can be any size 
{ - begin block 
} - end block 
12
Create return statement in 
programmes 
0 terminates the execution of a function and returns 
control to the calling function 
0 can also return a value to the calling function 
13
Comments 
0 useful for a variety of purposes 
0 provide the easiest way to point out specific parts of 
code 
0 2 forms: 
//  single line comment 
/* …..*/  multi line comment 
14
Single line comment 
0 useful for simple ‘side’ notes that explain what certain 
parts of the code do 
0 places: next to variable declarations & next to pieces 
of code that may need explanation 
15
0 Example: 
//this is first line 
//this is second line 
//this is third line 
//this is fourth line 
16
Multi line comment 
0 most useful for long explanation of code 
0 can be use as: 
copyright/licensing notices 
explain the purpose of a path of code 
0 can be useful in two aspects: 
make functions easier to understand 
easier to spot errors in code 
17
0 Example: 
/*this is first line 
this is second line 
this is third line 
this is fourth line*/ 
18
Create comments in programme 
19 
/*This is a programme that computes the sum of two integer 
numbers*/ 
#include<stdio.h> //This is a preprocessor 
main( ) //function main 
{ //Begin block 
int x, y, sum; //This is declaration of variable 
printf(Enter first number:”); //User output 
scanf(“%d”,&x); //User input 
printf(Enter second number:”); 
scanf(“%d”,&x); 
sum= x+y; //Operation for sum of two numbers 
printf(“nSum = %d”, sum); //Output 
return 0; //Return statement 
} //End block

More Related Content

What's hot

C language introduction geeksfor geeks
C language introduction   geeksfor geeksC language introduction   geeksfor geeks
C language introduction geeksfor geeks
AashutoshChhedavi
 
Principles of object oriented programing
Principles of object oriented programingPrinciples of object oriented programing
Principles of object oriented programing
Ahammed Alamin
 
Introduction to Computer and Programing - Lab2
Introduction to Computer and Programing - Lab2Introduction to Computer and Programing - Lab2
Introduction to Computer and Programing - Lab2
hassaanciit
 

What's hot (20)

Handout#11
Handout#11Handout#11
Handout#11
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
C language introduction geeksfor geeks
C language introduction   geeksfor geeksC language introduction   geeksfor geeks
C language introduction geeksfor geeks
 
Handout#01
Handout#01Handout#01
Handout#01
 
Hands-on Introduction to the C Programming Language
Hands-on Introduction to the C Programming LanguageHands-on Introduction to the C Programming Language
Hands-on Introduction to the C Programming Language
 
Content
Content Content
Content
 
Beginner C++ easy slide and simple definition with questions
Beginner C++ easy slide and simple definition with questions Beginner C++ easy slide and simple definition with questions
Beginner C++ easy slide and simple definition with questions
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Chapter2
Chapter2Chapter2
Chapter2
 
C language industrial training report
C language industrial training reportC language industrial training report
C language industrial training report
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c language
 
Principles of object oriented programing
Principles of object oriented programingPrinciples of object oriented programing
Principles of object oriented programing
 
C_Programming_Notes_ICE
C_Programming_Notes_ICEC_Programming_Notes_ICE
C_Programming_Notes_ICE
 
Handout#02
Handout#02Handout#02
Handout#02
 
Handout#03
Handout#03Handout#03
Handout#03
 
Cnotes
CnotesCnotes
Cnotes
 
C programming course material
C programming course materialC programming course material
C programming course material
 
Introduction to Computer and Programing - Lab2
Introduction to Computer and Programing - Lab2Introduction to Computer and Programing - Lab2
Introduction to Computer and Programing - Lab2
 
C program
C programC program
C program
 

Viewers also liked

8.1 alogorithm & prolem solving
8.1 alogorithm & prolem solving8.1 alogorithm & prolem solving
8.1 alogorithm & prolem solving
Khan Yousafzai
 

Viewers also liked (13)

c programme
c programmec programme
c programme
 
Basic C concepts.
Basic C concepts.Basic C concepts.
Basic C concepts.
 
C Language Program
C Language ProgramC Language Program
C Language Program
 
Prefix Postfix
Prefix PostfixPrefix Postfix
Prefix Postfix
 
Can my English course be translated to Tamil language?
Can my English course be translated to Tamil language?Can my English course be translated to Tamil language?
Can my English course be translated to Tamil language?
 
8.1 alogorithm & prolem solving
8.1 alogorithm & prolem solving8.1 alogorithm & prolem solving
8.1 alogorithm & prolem solving
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language Course
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
 
Structure in C
Structure in CStructure in C
Structure in C
 
FUNDAMENTAL OF C
FUNDAMENTAL OF CFUNDAMENTAL OF C
FUNDAMENTAL OF C
 
C ppt
C pptC ppt
C ppt
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
Lecture18 structurein c.ppt
Lecture18 structurein c.pptLecture18 structurein c.ppt
Lecture18 structurein c.ppt
 

Similar to CHAPTER 3

Introduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic conceptsIntroduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic concepts
ssuserf86fba
 
2. Consider the following C program #define M ... #define N ....pdf
2. Consider the following C program #define M ... #define N ....pdf2. Consider the following C program #define M ... #define N ....pdf
2. Consider the following C program #define M ... #define N ....pdf
SIGMATAX1
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
meharikiros2
 

Similar to CHAPTER 3 (20)

basic program
basic programbasic program
basic program
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptx
 
Introduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic conceptsIntroduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic concepts
 
Introduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to itIntroduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to it
 
Cp week _2.
Cp week _2.Cp week _2.
Cp week _2.
 
C Programming Language Step by Step Part 2
C Programming Language Step by Step Part 2C Programming Language Step by Step Part 2
C Programming Language Step by Step Part 2
 
ICT1002-W8-LEC-Introduction-to-C.pdf
ICT1002-W8-LEC-Introduction-to-C.pdfICT1002-W8-LEC-Introduction-to-C.pdf
ICT1002-W8-LEC-Introduction-to-C.pdf
 
C++ AND CATEGORIES OF SOFTWARE
C++ AND CATEGORIES OF SOFTWAREC++ AND CATEGORIES OF SOFTWARE
C++ AND CATEGORIES OF SOFTWARE
 
C++ Constructs.pptx
C++ Constructs.pptxC++ Constructs.pptx
C++ Constructs.pptx
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 
2. Consider the following C program #define M ... #define N ....pdf
2. Consider the following C program #define M ... #define N ....pdf2. Consider the following C program #define M ... #define N ....pdf
2. Consider the following C program #define M ... #define N ....pdf
 
Basic c programming and explanation PPT1
Basic c programming and explanation PPT1Basic c programming and explanation PPT1
Basic c programming and explanation PPT1
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptx
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
 
Stucture of c program
Stucture of c programStucture of c program
Stucture of c program
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Bcsl 031 solve assignment
 
Fp201 unit2 1
Fp201 unit2 1Fp201 unit2 1
Fp201 unit2 1
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).doc
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...
 

More from mohd_mizan (7)

Mind map chapter 4
Mind map chapter 4Mind map chapter 4
Mind map chapter 4
 
Dbs 1012 synopsis
Dbs 1012 synopsisDbs 1012 synopsis
Dbs 1012 synopsis
 
Chapter 4 work, energy and power
Chapter 4 work, energy and powerChapter 4 work, energy and power
Chapter 4 work, energy and power
 
CHAPTER 4
CHAPTER 4CHAPTER 4
CHAPTER 4
 
CHAPTER 6
CHAPTER 6CHAPTER 6
CHAPTER 6
 
CHAPTER 5
CHAPTER 5CHAPTER 5
CHAPTER 5
 
CHAPTER 2
CHAPTER 2CHAPTER 2
CHAPTER 2
 

Recently uploaded

The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated crops
parmarsneha2
 

Recently uploaded (20)

NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...
Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...
Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated crops
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 

CHAPTER 3

  • 1.
  • 2. OUTCOMES: Student should be able to: 0Explain the general form 0f C structure 0Write, Compile & Execute of C programme 2
  • 3. The general form of C programme 3
  • 4. Follow 3 steps: 0 Enter the programme 0 Compile the programme 0 Run the programme 2 terms: 0 Source code – the human readable form of the programme. It is stored in a text file 0 Object code – the executable form of the programme created by a compiler 4
  • 5. Write the general form of C programme 0 Entering the programme The name of the file that holds the source code for the programme is technically arbitrary C programme are normally contained in files that use the file extension (.cpp) 5
  • 6. 0 Compiling the programme You can compile your .cpp file depends on your compiler & what option you are using e.g: Microsoft Visual C++ Express Edition  provide 2 different ways of compiling a programme: the command-line compiler & the Integrated Development Environment (IDE) 6
  • 7. 0 Execute the debugged programme After a C programme has been compiled, it is ready to be run Since the output from a C compiler is executed object code, to run the programme, simply enter its name at the command prompt 7
  • 8. Pre-processor directives and header files 0 Pre-processor Is the directive to enables the programme to use certain function contained in the external file such as <stdio.h> 0 Header file Contain specific functions that used to accomplish the programming task e.g: ctype.h, math.h 8
  • 9. #include 0 replaces by the whole content of specified file 0 2 ways to specify a file: 9 #include “stdio.h” the file is looked for from the same directory in which the file that includes the directive is #include <stdio.h> the file is directly looked for in the default directories where the compiler is configured to look for standard header files
  • 10. serves to generate define constants or macros 10 #define #define variable_name value #define pepsi 2.50 #define grapes 8.50 Example:
  • 11. Create block {…} in Main function a function is a block of statements that is part of large programmes 0 Function main ( ) Must have at least the function main ( ) Must have a body enclosed in braces { } 11
  • 12. 0 Function block { } the function body  called block can be any size { - begin block } - end block 12
  • 13. Create return statement in programmes 0 terminates the execution of a function and returns control to the calling function 0 can also return a value to the calling function 13
  • 14. Comments 0 useful for a variety of purposes 0 provide the easiest way to point out specific parts of code 0 2 forms: //  single line comment /* …..*/  multi line comment 14
  • 15. Single line comment 0 useful for simple ‘side’ notes that explain what certain parts of the code do 0 places: next to variable declarations & next to pieces of code that may need explanation 15
  • 16. 0 Example: //this is first line //this is second line //this is third line //this is fourth line 16
  • 17. Multi line comment 0 most useful for long explanation of code 0 can be use as: copyright/licensing notices explain the purpose of a path of code 0 can be useful in two aspects: make functions easier to understand easier to spot errors in code 17
  • 18. 0 Example: /*this is first line this is second line this is third line this is fourth line*/ 18
  • 19. Create comments in programme 19 /*This is a programme that computes the sum of two integer numbers*/ #include<stdio.h> //This is a preprocessor main( ) //function main { //Begin block int x, y, sum; //This is declaration of variable printf(Enter first number:”); //User output scanf(“%d”,&x); //User input printf(Enter second number:”); scanf(“%d”,&x); sum= x+y; //Operation for sum of two numbers printf(“nSum = %d”, sum); //Output return 0; //Return statement } //End block