SlideShare a Scribd company logo
1 of 18
Computer Science: A Structured
Programming Approach Using C
2
2-4 Types
A type defines a set of values and a set of operations
that can be applied on those values.
Void Type
Integral Type
Floating-Point Types
Topics discussed in this section:
Computer Science: A Structured
Programming Approach Using C
3
FIGURE 2-7 Data Types
Computer Science: A Structured
Programming Approach Using C
4
FIGURE 2-8 Character Types
Computer Science: A Structured
Programming Approach Using C
5
FIGURE 2-9 Integer Types
Computer Science: A Structured
Programming Approach Using C
6
sizeof (short) ≤ sizeof (int) ≤ sizeof (long) ≤ sizeof (long long)
Note
Computer Science: A Structured
Programming Approach Using C
7
Table 2-3 Typical Integer Sizes and Values for Signed Integers
Computer Science: A Structured
Programming Approach Using C
8
FIGURE 2-10 Floating-point Types
Computer Science: A Structured
Programming Approach Using C
9
Computer Science: A Structured
Programming Approach Using C
10
sizeof (float) ≤ sizeof (double) ≤ sizeof (long double)
Note
Computer Science: A Structured
Programming Approach Using C
11
2-5 Variables
Variables are named memory locations that have a type,
such as integer or character, which is inherited from their
type. The type determines the values that a variable may
contain and the operations that may be used with its
values.
Variable Declaration
Variable Initialization
Topics discussed in this section:
Computer Science: A Structured
Programming Approach Using C
12
FIGURE 2-11 Variables
Computer Science: A Structured
Programming Approach Using C
13
Table 2-5 Examples of Variable Declarations and Definitions
Computer Science: A Structured
Programming Approach Using C
14
FIGURE 2-12 Variable Initialization
‘B’
Computer Science: A Structured
Programming Approach Using C
15
When a variable is defined, it is not initialized.
We must initialize any variable requiring
prescribed data when the function starts.
Note
Computer Science: A Structured
Programming Approach Using C
16
PROGRAM 2-2 Print Sum of Three Numbers
Computer Science: A Structured
Programming Approach Using C
17
PROGRAM 2-2 Print Sum of Three Numbers (continued)
Computer Science: A Structured
Programming Approach Using C
18
PROGRAM 2-2 Print Sum of Three Numbers (continued)

More Related Content

Similar to Chapter 02-02.pptx

Similar to Chapter 02-02.pptx (20)

Chap-02-1.ppt
Chap-02-1.pptChap-02-1.ppt
Chap-02-1.ppt
 
Variable-intro.pptx
Variable-intro.pptxVariable-intro.pptx
Variable-intro.pptx
 
Chap-14-1 (1).ppt
Chap-14-1 (1).pptChap-14-1 (1).ppt
Chap-14-1 (1).ppt
 
Intro
IntroIntro
Intro
 
Chap-08-4.ppt
Chap-08-4.pptChap-08-4.ppt
Chap-08-4.ppt
 
Cs8251 faq1
Cs8251 faq1Cs8251 faq1
Cs8251 faq1
 
Chap 11-1
Chap 11-1Chap 11-1
Chap 11-1
 
Chap-03-1.ppt
Chap-03-1.pptChap-03-1.ppt
Chap-03-1.ppt
 
Chap-07-1.ppt
Chap-07-1.pptChap-07-1.ppt
Chap-07-1.ppt
 
CHAPTER-2.ppt
CHAPTER-2.pptCHAPTER-2.ppt
CHAPTER-2.ppt
 
Programming with c language practical manual
Programming with c language practical manualProgramming with c language practical manual
Programming with c language practical manual
 
Fy secondsemester2016
Fy secondsemester2016Fy secondsemester2016
Fy secondsemester2016
 
Fy secondsemester2016
Fy secondsemester2016Fy secondsemester2016
Fy secondsemester2016
 
Fy secondsemester2016
Fy secondsemester2016Fy secondsemester2016
Fy secondsemester2016
 
CODING-DAY-2-INTRODUCTION TO C PROGRAMMING.ppt
CODING-DAY-2-INTRODUCTION TO C PROGRAMMING.pptCODING-DAY-2-INTRODUCTION TO C PROGRAMMING.ppt
CODING-DAY-2-INTRODUCTION TO C PROGRAMMING.ppt
 
test(3)arithmetic in c
test(3)arithmetic in ctest(3)arithmetic in c
test(3)arithmetic in c
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to c
 
Chap 01-1 jwfiles
Chap 01-1 jwfilesChap 01-1 jwfiles
Chap 01-1 jwfiles
 
6276830.ppt
6276830.ppt6276830.ppt
6276830.ppt
 
Computer graphics 9068
Computer graphics  9068Computer graphics  9068
Computer graphics 9068
 

Recently uploaded

Jai Institute for Parenting Program Guide
Jai Institute for Parenting Program GuideJai Institute for Parenting Program Guide
Jai Institute for Parenting Program Guidekiva6
 
The Impact of Digital Technologies
The Impact of Digital Technologies The Impact of Digital Technologies
The Impact of Digital Technologies bruguardarib
 
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...Search Engine Journal
 
What are the 4 characteristics of CTAs that convert?
What are the 4 characteristics of CTAs that convert?What are the 4 characteristics of CTAs that convert?
What are the 4 characteristics of CTAs that convert?Juan Pineda
 
Cost-effective tactics for navigating CPC surges
Cost-effective tactics for navigating CPC surgesCost-effective tactics for navigating CPC surges
Cost-effective tactics for navigating CPC surgesPushON Ltd
 
GreenSEO April 2024: Join the Green Web Revolution
GreenSEO April 2024: Join the Green Web RevolutionGreenSEO April 2024: Join the Green Web Revolution
GreenSEO April 2024: Join the Green Web RevolutionWilliam Barnes
 
TAM AdEx 2023 Cross Media Advertising Recap - Auto Sector
TAM AdEx 2023 Cross Media Advertising Recap - Auto SectorTAM AdEx 2023 Cross Media Advertising Recap - Auto Sector
TAM AdEx 2023 Cross Media Advertising Recap - Auto SectorSocial Samosa
 
Red bull marketing presentation pptxxxxx
Red bull marketing presentation pptxxxxxRed bull marketing presentation pptxxxxx
Red bull marketing presentation pptxxxxx216310017
 
DGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdf
DGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdfDGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdf
DGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdfDemandbase
 
Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
How videos can elevate your Google rankings and improve your EEAT - Benjamin ...
How videos can elevate your Google rankings and improve your EEAT - Benjamin ...How videos can elevate your Google rankings and improve your EEAT - Benjamin ...
How videos can elevate your Google rankings and improve your EEAT - Benjamin ...Benjamin Szturmaj
 
Word Count for Writers: Examples of Word Counts for Sample Genres
Word Count for Writers: Examples of Word Counts for Sample GenresWord Count for Writers: Examples of Word Counts for Sample Genres
Word Count for Writers: Examples of Word Counts for Sample GenresLisa M. Masiello
 
Storyboards for my Final Major Project Video
Storyboards for my Final Major Project VideoStoryboards for my Final Major Project Video
Storyboards for my Final Major Project VideoSineadBidwell
 
Omnichannel Marketing: Defining Omnichannel Marketing
Omnichannel Marketing: Defining Omnichannel MarketingOmnichannel Marketing: Defining Omnichannel Marketing
Omnichannel Marketing: Defining Omnichannel MarketingDove Soft Ltd
 
Influencer Marketing Power point presentation
Influencer Marketing  Power point presentationInfluencer Marketing  Power point presentation
Influencer Marketing Power point presentationdgtivemarketingagenc
 
Social Samosa Guidebook for SAMMIES 2024.pdf
Social Samosa Guidebook for SAMMIES 2024.pdfSocial Samosa Guidebook for SAMMIES 2024.pdf
Social Samosa Guidebook for SAMMIES 2024.pdfSocial Samosa
 
pptx.marketing strategy of tanishq. pptx
pptx.marketing strategy of tanishq. pptxpptx.marketing strategy of tanishq. pptx
pptx.marketing strategy of tanishq. pptxarsathsahil
 
McDonald's: A Journey Through Time (PPT)
McDonald's: A Journey Through Time (PPT)McDonald's: A Journey Through Time (PPT)
McDonald's: A Journey Through Time (PPT)DEVARAJV16
 
定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一
定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一
定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一s SS
 
How To Utilize Calculated Properties in your HubSpot Setup
How To Utilize Calculated Properties in your HubSpot SetupHow To Utilize Calculated Properties in your HubSpot Setup
How To Utilize Calculated Properties in your HubSpot Setupssuser4571da
 

Recently uploaded (20)

Jai Institute for Parenting Program Guide
Jai Institute for Parenting Program GuideJai Institute for Parenting Program Guide
Jai Institute for Parenting Program Guide
 
The Impact of Digital Technologies
The Impact of Digital Technologies The Impact of Digital Technologies
The Impact of Digital Technologies
 
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...
 
What are the 4 characteristics of CTAs that convert?
What are the 4 characteristics of CTAs that convert?What are the 4 characteristics of CTAs that convert?
What are the 4 characteristics of CTAs that convert?
 
Cost-effective tactics for navigating CPC surges
Cost-effective tactics for navigating CPC surgesCost-effective tactics for navigating CPC surges
Cost-effective tactics for navigating CPC surges
 
GreenSEO April 2024: Join the Green Web Revolution
GreenSEO April 2024: Join the Green Web RevolutionGreenSEO April 2024: Join the Green Web Revolution
GreenSEO April 2024: Join the Green Web Revolution
 
TAM AdEx 2023 Cross Media Advertising Recap - Auto Sector
TAM AdEx 2023 Cross Media Advertising Recap - Auto SectorTAM AdEx 2023 Cross Media Advertising Recap - Auto Sector
TAM AdEx 2023 Cross Media Advertising Recap - Auto Sector
 
Red bull marketing presentation pptxxxxx
Red bull marketing presentation pptxxxxxRed bull marketing presentation pptxxxxx
Red bull marketing presentation pptxxxxx
 
DGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdf
DGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdfDGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdf
DGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdf
 
Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝
 
How videos can elevate your Google rankings and improve your EEAT - Benjamin ...
How videos can elevate your Google rankings and improve your EEAT - Benjamin ...How videos can elevate your Google rankings and improve your EEAT - Benjamin ...
How videos can elevate your Google rankings and improve your EEAT - Benjamin ...
 
Word Count for Writers: Examples of Word Counts for Sample Genres
Word Count for Writers: Examples of Word Counts for Sample GenresWord Count for Writers: Examples of Word Counts for Sample Genres
Word Count for Writers: Examples of Word Counts for Sample Genres
 
Storyboards for my Final Major Project Video
Storyboards for my Final Major Project VideoStoryboards for my Final Major Project Video
Storyboards for my Final Major Project Video
 
Omnichannel Marketing: Defining Omnichannel Marketing
Omnichannel Marketing: Defining Omnichannel MarketingOmnichannel Marketing: Defining Omnichannel Marketing
Omnichannel Marketing: Defining Omnichannel Marketing
 
Influencer Marketing Power point presentation
Influencer Marketing  Power point presentationInfluencer Marketing  Power point presentation
Influencer Marketing Power point presentation
 
Social Samosa Guidebook for SAMMIES 2024.pdf
Social Samosa Guidebook for SAMMIES 2024.pdfSocial Samosa Guidebook for SAMMIES 2024.pdf
Social Samosa Guidebook for SAMMIES 2024.pdf
 
pptx.marketing strategy of tanishq. pptx
pptx.marketing strategy of tanishq. pptxpptx.marketing strategy of tanishq. pptx
pptx.marketing strategy of tanishq. pptx
 
McDonald's: A Journey Through Time (PPT)
McDonald's: A Journey Through Time (PPT)McDonald's: A Journey Through Time (PPT)
McDonald's: A Journey Through Time (PPT)
 
定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一
定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一
定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一
 
How To Utilize Calculated Properties in your HubSpot Setup
How To Utilize Calculated Properties in your HubSpot SetupHow To Utilize Calculated Properties in your HubSpot Setup
How To Utilize Calculated Properties in your HubSpot Setup
 

Chapter 02-02.pptx

  • 1.
  • 2. Computer Science: A Structured Programming Approach Using C 2 2-4 Types A type defines a set of values and a set of operations that can be applied on those values. Void Type Integral Type Floating-Point Types Topics discussed in this section:
  • 3. Computer Science: A Structured Programming Approach Using C 3 FIGURE 2-7 Data Types
  • 4. Computer Science: A Structured Programming Approach Using C 4 FIGURE 2-8 Character Types
  • 5. Computer Science: A Structured Programming Approach Using C 5 FIGURE 2-9 Integer Types
  • 6. Computer Science: A Structured Programming Approach Using C 6 sizeof (short) ≤ sizeof (int) ≤ sizeof (long) ≤ sizeof (long long) Note
  • 7. Computer Science: A Structured Programming Approach Using C 7 Table 2-3 Typical Integer Sizes and Values for Signed Integers
  • 8. Computer Science: A Structured Programming Approach Using C 8 FIGURE 2-10 Floating-point Types
  • 9. Computer Science: A Structured Programming Approach Using C 9
  • 10. Computer Science: A Structured Programming Approach Using C 10 sizeof (float) ≤ sizeof (double) ≤ sizeof (long double) Note
  • 11. Computer Science: A Structured Programming Approach Using C 11 2-5 Variables Variables are named memory locations that have a type, such as integer or character, which is inherited from their type. The type determines the values that a variable may contain and the operations that may be used with its values. Variable Declaration Variable Initialization Topics discussed in this section:
  • 12. Computer Science: A Structured Programming Approach Using C 12 FIGURE 2-11 Variables
  • 13. Computer Science: A Structured Programming Approach Using C 13 Table 2-5 Examples of Variable Declarations and Definitions
  • 14. Computer Science: A Structured Programming Approach Using C 14 FIGURE 2-12 Variable Initialization ‘B’
  • 15. Computer Science: A Structured Programming Approach Using C 15 When a variable is defined, it is not initialized. We must initialize any variable requiring prescribed data when the function starts. Note
  • 16. Computer Science: A Structured Programming Approach Using C 16 PROGRAM 2-2 Print Sum of Three Numbers
  • 17. Computer Science: A Structured Programming Approach Using C 17 PROGRAM 2-2 Print Sum of Three Numbers (continued)
  • 18. Computer Science: A Structured Programming Approach Using C 18 PROGRAM 2-2 Print Sum of Three Numbers (continued)

Editor's Notes

  1. wchar_t is a wide character:  The increased datatype size allows for the use of larger coded character sets. Width is compiler specific (not portable).