SlideShare uma empresa Scribd logo
1 de 31
Chapter 3: Introduction to C Programming Language ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C Development Environment Phase 2  : Preprocessor program processes the  code. Preprocessor Disk Disk Compiler Phase 3  : Compiler  creates object code and stores  it  on Disk . Disk Linker Phase 4  : Linker links object  code with libraries,  creates  a.out  and  stores it  on Disk. Editor Phase 1  : Program is created in the Editor and  stored on Disk. Disk
Loader Phase 5  : : . Primary Memory Loader puts Program in Memory C P U Phase 6  : : . Primary Memory CPU takes each instruction and  executes it, storing new data values as the program executes.
From code to executables Executable Code Pre-processor Source  Code Compiler Assembler Linker Libraries Assembly  Code Object  Code
A Simple Program Example #include <stdio.h> main() { printf(&quot;Programming in C is easy.&quot;); } Sample Program Output Programming in C is easy.
[object Object],[object Object],[object Object],[object Object],[object Object]
The purpose of the statement #include <stdio.h> is to allow the use of the  printf  statement to provide program output. Text to be displayed by  printf()  must be enclosed in double quotes. The program has only one statement  printf(&quot;Programming in C is easy.&quot;); printf()  is actually a function (procedure) in C that is used for printing variables and text. Where text appears in double quotes &quot;&quot;, it is printed without modification. There are some exceptions however.
This has to do with the and % characters. These characters are modifiers, and for the present the followed by the n character represents a newline character.  Thus the program prints Programming in C is easy. and the cursor is set to the beginning of the next line. As we shall see later on, what follows the character will determine what is printed, ie, a tab, clear screen, clear line etc. Another important thing to remember is that all C statements are terminated by a semi-colon ;
[object Object],[object Object],[object Object],[object Object],[object Object]
Characters and tokens ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Reserved Words ,[object Object],[object Object],[object Object],[object Object]
Identifiers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Constants ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
String Literals ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Punctuators (separators) ,[object Object],[object Object],[object Object],[object Object]
Operators ,[object Object],[object Object],[object Object],[object Object],[object Object]
Structure of a C program Preprocessor directive (header file) Program statement } Preprocessor directive Global variable declaration Comments Local variable declaration Variable definition
Comments ,[object Object],[object Object],[object Object],[object Object]
Preprocessor Directives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic Data Types ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
Statements ,[object Object],[object Object],[object Object],[object Object],[object Object]
Basic Functions ,[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
printf() ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Format Specifier Tells the printf() function the format of the output to be printed put.
Escape Sequence Escape sequence is used in the printf() function to do something to the output.
scanf() ,[object Object],[object Object],[object Object],[object Object],[object Object]
getchar() and putchar() ,[object Object],[object Object],[object Object],#include <stdio.h> void main(void) { char my_char; printf(“Please type a character: “); my_char = getchar(); printf(“You have typed this character: “); putchar(my_char); }

Mais conteúdo relacionado

Mais procurados

1. over view and history of c
1. over view and history of c1. over view and history of c
1. over view and history of c
Harish Kumawat
 
Overview of c++
Overview of c++Overview of c++
Overview of c++
geeeeeet
 

Mais procurados (20)

Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILE
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
 
1. over view and history of c
1. over view and history of c1. over view and history of c
1. over view and history of c
 
Introduction of c programming
Introduction of c programmingIntroduction of c programming
Introduction of c programming
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
Single pass assembler
Single pass assemblerSingle pass assembler
Single pass assembler
 
Introduction to Computer
Introduction to ComputerIntroduction to Computer
Introduction to Computer
 
Overview of c++
Overview of c++Overview of c++
Overview of c++
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ Language
 
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTTC programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
 
String c
String cString c
String c
 
pdf c programming language.pdf
pdf c programming language.pdfpdf c programming language.pdf
pdf c programming language.pdf
 
Types of software
Types of softwareTypes of software
Types of software
 
C tutorial
C tutorialC tutorial
C tutorial
 
Hm system programming class 1
Hm system programming class 1Hm system programming class 1
Hm system programming class 1
 
C language
C languageC language
C language
 
Passes of compilers
Passes of compilersPasses of compilers
Passes of compilers
 

Semelhante a Chapter3

C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)
indrasir
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to c
Hattori Sidek
 

Semelhante a Chapter3 (20)

C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Function
 
(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
 
Unit 2 introduction to c programming
Unit 2   introduction to c programmingUnit 2   introduction to c programming
Unit 2 introduction to c programming
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
Programming in C - interview questions.pdf
Programming in C - interview questions.pdfProgramming in C - interview questions.pdf
Programming in C - interview questions.pdf
 
C programming
C programmingC programming
C programming
 
C programming
C programmingC programming
C programming
 
Sample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.SivakumarSample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.Sivakumar
 
Introduction to C Unit 1
Introduction to C Unit 1Introduction to C Unit 1
Introduction to C Unit 1
 
Programming Fundamentals lecture 5
Programming Fundamentals lecture 5Programming Fundamentals lecture 5
Programming Fundamentals lecture 5
 
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
 
c_pro_introduction.pptx
c_pro_introduction.pptxc_pro_introduction.pptx
c_pro_introduction.pptx
 
Introduction to C Programming - I
Introduction to C Programming - I Introduction to C Programming - I
Introduction to C Programming - I
 
C++ AND CATEGORIES OF SOFTWARE
C++ AND CATEGORIES OF SOFTWAREC++ AND CATEGORIES OF SOFTWARE
C++ AND CATEGORIES OF SOFTWARE
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to c
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance level
 

Mais de Kamran (7)

History
HistoryHistory
History
 
Operators
OperatorsOperators
Operators
 
Loops
LoopsLoops
Loops
 
Introduction
IntroductionIntroduction
Introduction
 
C chap02
C chap02C chap02
C chap02
 
C introduction
C introductionC introduction
C introduction
 
C intro
C introC intro
C intro
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

Chapter3

  • 1.
  • 2. C Development Environment Phase 2 : Preprocessor program processes the code. Preprocessor Disk Disk Compiler Phase 3 : Compiler creates object code and stores it on Disk . Disk Linker Phase 4 : Linker links object code with libraries, creates a.out and stores it on Disk. Editor Phase 1 : Program is created in the Editor and stored on Disk. Disk
  • 3. Loader Phase 5 : : . Primary Memory Loader puts Program in Memory C P U Phase 6 : : . Primary Memory CPU takes each instruction and executes it, storing new data values as the program executes.
  • 4. From code to executables Executable Code Pre-processor Source Code Compiler Assembler Linker Libraries Assembly Code Object Code
  • 5. A Simple Program Example #include <stdio.h> main() { printf(&quot;Programming in C is easy.&quot;); } Sample Program Output Programming in C is easy.
  • 6.
  • 7. The purpose of the statement #include <stdio.h> is to allow the use of the printf statement to provide program output. Text to be displayed by printf() must be enclosed in double quotes. The program has only one statement printf(&quot;Programming in C is easy.&quot;); printf() is actually a function (procedure) in C that is used for printing variables and text. Where text appears in double quotes &quot;&quot;, it is printed without modification. There are some exceptions however.
  • 8. This has to do with the and % characters. These characters are modifiers, and for the present the followed by the n character represents a newline character. Thus the program prints Programming in C is easy. and the cursor is set to the beginning of the next line. As we shall see later on, what follows the character will determine what is printed, ie, a tab, clear screen, clear line etc. Another important thing to remember is that all C statements are terminated by a semi-colon ;
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19. Structure of a C program Preprocessor directive (header file) Program statement } Preprocessor directive Global variable declaration Comments Local variable declaration Variable definition
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. Format Specifier Tells the printf() function the format of the output to be printed put.
  • 29. Escape Sequence Escape sequence is used in the printf() function to do something to the output.
  • 30.
  • 31.