SlideShare a Scribd company logo
1 of 23
Overview of C language
History
 C is a structured programming language developed by
Dennis Ritchie in 1973 at Bell Laboratories.
 C programming language features were derived from
an earlier language called “B”.
 C language was invented for implementing UNIX
operating system.
 Today's most popular Linux OS and RBDMS MySQL
have been written in C.
Features
 Simple
 Portable
 Structured programming language
 Rich library
 Memory Management
 Speed
 Pointer
 Recursion
 Middle level language
Basic Structure of ‘C’
Basic Structure of ‘C’ (Cont.)
 Documentation Section :-
 It has set of comment lines(name of program, author
details).
 Non-executable statement.
 Can’t be nested.
 eg. /* Program to find factorial of a number
By: Smith */
/* Welcome /* friends */ ! */ Illegal
Basic Structure of ‘C’ (Cont.)
 Link Section :-
 It provides instructions to the compiler to link function
from the system library.
 # include Directive:- It tells the preprocessor to insert
the contents of another file into the source code at the
point where the #include directive is found.
 stdio– Standard Input /Output
 conio– Console input/Output
 math- contains mathematical functions like(cos(), sin(),
sqrt(), abs())
 Eg. #include<stdio.h>
Basic Structure of ‘C’ (Cont.)
 Definition Section :-
 It defines all symbolic constants.
 eg. #define PI 3.14
 It’s not a statement. Therefore it should not end with a
semicolon.
 Generally written in uppercase.
Basic Structure of ‘C’ (Cont.)
 Global Declaration Section :-
 Two types of declarations:
1.) Local variable declaration
2.) Global variable declaration
 Global variables are declared out side the main
function. Scope of variable is whole program.
 Local variables are declared inside the main function.
Scope of variable is the function in which it is declared.
Basic Structure of ‘C’ (Cont.)
 main() function Section :-
 Every C program must have one main function section.
 Two parts,
1) Declaration part: It declares all the variables used in
the executable part.
2) Executable part: It contains instructions to perform
certain task.
Basic Structure of ‘C’ (Cont.)
 Subprogram Section :-
 It contains body of user defined function.
 Eg. int sum (int a, int b)
{
int c;
c=a+b;
return c;
}
Example 1
 /*Documentation Section: Program to find the area of
circle*/
#include <stdio.h> /*link section*/
#include <conio.h>/*link section*/
#define PI 3.14 /*definition section*/
float area; /*global declaration section*/
void main()
{
float r; /*declaration part*/
printf("Enter the radius of the circlen"); /*executable
part starts here*/
Example 1(Cont.)
scanf("%f",&r);
area=PI*r*r;
printf("Area of the circle=%f",area);
getch();
}
Basic Syntax
Tokens
 A token is either a keyword, an identifier, a constant, a
string literal, or a symbol.
 Eg. printf("Hello, World! n");
 The individual tokens are:
printf
(
"Hello, World! n"
)
;
Semicolons(;)
 It is a statement terminator.
 Each individual statement must be ended with a
semicolon.
 It indicates the end of one logical entity.
 Eg.
printf("Hello, World! n");
return 0;
or
printf("Hello, World! n"); return 0;
Comments
 Comments are like helping text in your C program and
they are ignored by the compiler.
 Single line comment: //first program in c
 Multiline comment: /* first
program
in
C */
Identifiers
 A C identifier is a name used to identify a variable,
function, or any other user-defined item.
 An identifier starts with a letter A to Z or a to z or an
underscore _ followed by zero or more letters,
underscores, and digits (0 to 9).
 C does not allow punctuation characters such as @, $,
and % within identifiers.
 C is a case sensitive programming language.
 Eg. int money;
 Here, money is identifier.
Identifiers(Cont.)
 Acceptable identifiers:
 mohan zara abc
 move_name a_123 myname50
 _temp j a23b9
 retVal
Keywords
 They are reserved words in C.
 These reserved words may not be used as constant or
variable or any other identifier names.
 Eg. int money;
 Here, int is keyword.
Whitespace
 Whitespace describes blanks, tabs(t), newline(n)
characters.
 Whitespace separates one part of a statement from
another and enables the compiler to identify where one
element in a statement, such as int, ends and the next
element begins.
 Eg. int age;
Q & A
 abc@12
 xyz!
 Smith
 S09
 A_b
 $abc
 12ab
 float
 break

More Related Content

Similar to 2.Overview of C language.pptx

C language introduction geeksfor geeks
C language introduction   geeksfor geeksC language introduction   geeksfor geeks
C language introduction geeksfor geeksAashutoshChhedavi
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to cHattori Sidek
 
Copy of UNIT 2 -- Basics Of Programming.pptx
Copy of UNIT 2 -- Basics Of Programming.pptxCopy of UNIT 2 -- Basics Of Programming.pptx
Copy of UNIT 2 -- Basics Of Programming.pptxrahulrajbhar06478
 
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptxIIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptxrajkumar490591
 
Computer programming(CP)
Computer programming(CP)Computer programming(CP)
Computer programming(CP)nmahi96
 
(Lect. 2 & 3) Introduction to C.ppt
(Lect. 2 & 3) Introduction to C.ppt(Lect. 2 & 3) Introduction to C.ppt
(Lect. 2 & 3) Introduction to C.pptatulchaudhary821
 
C programming presentation(final)
C programming presentation(final)C programming presentation(final)
C programming presentation(final)aaravSingh41
 
Unit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxUnit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxSanketShah544615
 
C programming slide day 01 uploadd by md abdullah al shakil
C programming slide day 01 uploadd by md abdullah al shakilC programming slide day 01 uploadd by md abdullah al shakil
C programming slide day 01 uploadd by md abdullah al shakilZenith SVG
 
Unit 2 introduction to c programming
Unit 2   introduction to c programmingUnit 2   introduction to c programming
Unit 2 introduction to c programmingMithun DSouza
 

Similar to 2.Overview of C language.pptx (20)

C language introduction geeksfor geeks
C language introduction   geeksfor geeksC language introduction   geeksfor geeks
C language introduction geeksfor geeks
 
C language
C languageC language
C language
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to c
 
Copy of UNIT 2 -- Basics Of Programming.pptx
Copy of UNIT 2 -- Basics Of Programming.pptxCopy of UNIT 2 -- Basics Of Programming.pptx
Copy of UNIT 2 -- Basics Of Programming.pptx
 
The smartpath information systems c pro
The smartpath information systems c proThe smartpath information systems c pro
The smartpath information systems c pro
 
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptxIIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
 
Introduction%20C.pptx
Introduction%20C.pptxIntroduction%20C.pptx
Introduction%20C.pptx
 
Computer programming(CP)
Computer programming(CP)Computer programming(CP)
Computer programming(CP)
 
UNIT 1 NOTES.docx
UNIT 1 NOTES.docxUNIT 1 NOTES.docx
UNIT 1 NOTES.docx
 
(Lect. 2 & 3) Introduction to C.ppt
(Lect. 2 & 3) Introduction to C.ppt(Lect. 2 & 3) Introduction to C.ppt
(Lect. 2 & 3) Introduction to C.ppt
 
C programming presentation(final)
C programming presentation(final)C programming presentation(final)
C programming presentation(final)
 
C language tutorial
C language tutorialC language tutorial
C language tutorial
 
Unit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxUnit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptx
 
C LANGUAGE NOTES
C LANGUAGE NOTESC LANGUAGE NOTES
C LANGUAGE NOTES
 
OVERVIEW OF ‘C’ PROGRAM
OVERVIEW OF ‘C’ PROGRAMOVERVIEW OF ‘C’ PROGRAM
OVERVIEW OF ‘C’ PROGRAM
 
C programming slide day 01 uploadd by md abdullah al shakil
C programming slide day 01 uploadd by md abdullah al shakilC programming slide day 01 uploadd by md abdullah al shakil
C programming slide day 01 uploadd by md abdullah al shakil
 
Unit 2 introduction to c programming
Unit 2   introduction to c programmingUnit 2   introduction to c programming
Unit 2 introduction to c programming
 
C programming.pdf
C programming.pdfC programming.pdf
C programming.pdf
 
Overview of c
Overview of cOverview of c
Overview of c
 
Programming C Part 01
Programming C Part 01 Programming C Part 01
Programming C Part 01
 

Recently uploaded

How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationAadityaSharma884161
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 

Recently uploaded (20)

How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint Presentation
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 

2.Overview of C language.pptx

  • 1. Overview of C language
  • 2. History  C is a structured programming language developed by Dennis Ritchie in 1973 at Bell Laboratories.  C programming language features were derived from an earlier language called “B”.  C language was invented for implementing UNIX operating system.  Today's most popular Linux OS and RBDMS MySQL have been written in C.
  • 3.
  • 4. Features  Simple  Portable  Structured programming language  Rich library  Memory Management  Speed  Pointer  Recursion  Middle level language
  • 6. Basic Structure of ‘C’ (Cont.)  Documentation Section :-  It has set of comment lines(name of program, author details).  Non-executable statement.  Can’t be nested.  eg. /* Program to find factorial of a number By: Smith */ /* Welcome /* friends */ ! */ Illegal
  • 7. Basic Structure of ‘C’ (Cont.)  Link Section :-  It provides instructions to the compiler to link function from the system library.  # include Directive:- It tells the preprocessor to insert the contents of another file into the source code at the point where the #include directive is found.  stdio– Standard Input /Output  conio– Console input/Output  math- contains mathematical functions like(cos(), sin(), sqrt(), abs())  Eg. #include<stdio.h>
  • 8. Basic Structure of ‘C’ (Cont.)  Definition Section :-  It defines all symbolic constants.  eg. #define PI 3.14  It’s not a statement. Therefore it should not end with a semicolon.  Generally written in uppercase.
  • 9. Basic Structure of ‘C’ (Cont.)  Global Declaration Section :-  Two types of declarations: 1.) Local variable declaration 2.) Global variable declaration  Global variables are declared out side the main function. Scope of variable is whole program.  Local variables are declared inside the main function. Scope of variable is the function in which it is declared.
  • 10. Basic Structure of ‘C’ (Cont.)  main() function Section :-  Every C program must have one main function section.  Two parts, 1) Declaration part: It declares all the variables used in the executable part. 2) Executable part: It contains instructions to perform certain task.
  • 11. Basic Structure of ‘C’ (Cont.)  Subprogram Section :-  It contains body of user defined function.  Eg. int sum (int a, int b) { int c; c=a+b; return c; }
  • 12. Example 1  /*Documentation Section: Program to find the area of circle*/ #include <stdio.h> /*link section*/ #include <conio.h>/*link section*/ #define PI 3.14 /*definition section*/ float area; /*global declaration section*/ void main() { float r; /*declaration part*/ printf("Enter the radius of the circlen"); /*executable part starts here*/
  • 15. Tokens  A token is either a keyword, an identifier, a constant, a string literal, or a symbol.  Eg. printf("Hello, World! n");  The individual tokens are: printf ( "Hello, World! n" ) ;
  • 16. Semicolons(;)  It is a statement terminator.  Each individual statement must be ended with a semicolon.  It indicates the end of one logical entity.  Eg. printf("Hello, World! n"); return 0; or printf("Hello, World! n"); return 0;
  • 17. Comments  Comments are like helping text in your C program and they are ignored by the compiler.  Single line comment: //first program in c  Multiline comment: /* first program in C */
  • 18. Identifiers  A C identifier is a name used to identify a variable, function, or any other user-defined item.  An identifier starts with a letter A to Z or a to z or an underscore _ followed by zero or more letters, underscores, and digits (0 to 9).  C does not allow punctuation characters such as @, $, and % within identifiers.  C is a case sensitive programming language.  Eg. int money;  Here, money is identifier.
  • 19. Identifiers(Cont.)  Acceptable identifiers:  mohan zara abc  move_name a_123 myname50  _temp j a23b9  retVal
  • 20. Keywords  They are reserved words in C.  These reserved words may not be used as constant or variable or any other identifier names.  Eg. int money;  Here, int is keyword.
  • 21.
  • 22. Whitespace  Whitespace describes blanks, tabs(t), newline(n) characters.  Whitespace separates one part of a statement from another and enables the compiler to identify where one element in a statement, such as int, ends and the next element begins.  Eg. int age;
  • 23. Q & A  abc@12  xyz!  Smith  S09  A_b  $abc  12ab  float  break