SlideShare ist ein Scribd-Unternehmen logo
1 von 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)

Weitere Àhnliche Inhalte

Ähnlich wie Chapter 02-02.pptx

Chap-02-1.ppt
Chap-02-1.pptChap-02-1.ppt
Chap-02-1.pptAbdulSacur2
 
Variable-intro.pptx
Variable-intro.pptxVariable-intro.pptx
Variable-intro.pptxssuser5ad1571
 
Chap-14-1 (1).ppt
Chap-14-1 (1).pptChap-14-1 (1).ppt
Chap-14-1 (1).pptOmPrakasDas
 
CHAPTER-2.ppt
CHAPTER-2.pptCHAPTER-2.ppt
CHAPTER-2.pptTekle12
 
Programming with c language practical manual
Programming with c language practical manualProgramming with c language practical manual
Programming with c language practical manualAnil Bishnoi
 
Fy secondsemester2016
Fy secondsemester2016Fy secondsemester2016
Fy secondsemester2016Ankit Dubey
 
Fy secondsemester2016
Fy secondsemester2016Fy secondsemester2016
Fy secondsemester2016Ankit Dubey
 
Fy secondsemester2016
Fy secondsemester2016Fy secondsemester2016
Fy secondsemester2016Ankit Dubey
 
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.pptadamjackson818417
 
test(3)arithmetic in c
test(3)arithmetic in ctest(3)arithmetic in c
test(3)arithmetic in cJaya Malathy
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to cHattori Sidek
 
Chap 01-1 jwfiles
Chap 01-1 jwfilesChap 01-1 jwfiles
Chap 01-1 jwfilesSuresh Nannuri
 
6276830.ppt
6276830.ppt6276830.ppt
6276830.pptShrinivas54
 
Computer graphics 9068
Computer graphics  9068Computer graphics  9068
Computer graphics 90681061992
 

Ähnlich wie 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
 

KĂŒrzlich hochgeladen

Elevating Your Digital Presence by Evitha.pdf
Elevating Your Digital Presence by Evitha.pdfElevating Your Digital Presence by Evitha.pdf
Elevating Your Digital Presence by Evitha.pdfevithatojoparel
 
Best 5 Graphics Designing Course In Chandigarh
Best 5 Graphics Designing Course In ChandigarhBest 5 Graphics Designing Course In Chandigarh
Best 5 Graphics Designing Course In Chandigarhhamitthakurdma01
 
Martal Group - B2B Lead Gen Agency - Onboarding Overview
Martal Group - B2B Lead Gen Agency - Onboarding OverviewMartal Group - B2B Lead Gen Agency - Onboarding Overview
Martal Group - B2B Lead Gen Agency - Onboarding OverviewMartal Group
 
Busty Desi⚡Call Girls in Sector 135 Noida Escorts >àŒ’8448380779 Escort Service
Busty Desi⚡Call Girls in Sector 135 Noida Escorts >àŒ’8448380779 Escort ServiceBusty Desi⚡Call Girls in Sector 135 Noida Escorts >àŒ’8448380779 Escort Service
Busty Desi⚡Call Girls in Sector 135 Noida Escorts >àŒ’8448380779 Escort ServiceDelhi Call girls
 
Enhancing Business Visibility PR Firms in San Francisco
Enhancing Business Visibility PR Firms in San FranciscoEnhancing Business Visibility PR Firms in San Francisco
Enhancing Business Visibility PR Firms in San Franciscosanfranciscoprfirms
 
The Science of Landing Page Messaging.pdf
The Science of Landing Page Messaging.pdfThe Science of Landing Page Messaging.pdf
The Science of Landing Page Messaging.pdfVWO
 
Welcome to DataMetricks Consulting (1).pptx
Welcome to DataMetricks Consulting (1).pptxWelcome to DataMetricks Consulting (1).pptx
Welcome to DataMetricks Consulting (1).pptxdatametricks
 
Press Release Distribution Evolving with Digital Trends.pdf
Press Release Distribution Evolving with Digital Trends.pdfPress Release Distribution Evolving with Digital Trends.pdf
Press Release Distribution Evolving with Digital Trends.pdfPR Wires
 
Choosing the Right White Label SEO Services to Boost Your Agency's Growth.pdf
Choosing the Right White Label SEO Services to Boost Your Agency's Growth.pdfChoosing the Right White Label SEO Services to Boost Your Agency's Growth.pdf
Choosing the Right White Label SEO Services to Boost Your Agency's Growth.pdfAutus Digital
 
Social Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh BendaySocial Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh BendayMaharshBenday
 
FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756dollysharma2066
 
Elevate Your Advertising Game: Introducing Billion Broadcaster Lift Advertising
Elevate Your Advertising Game: Introducing Billion Broadcaster Lift AdvertisingElevate Your Advertising Game: Introducing Billion Broadcaster Lift Advertising
Elevate Your Advertising Game: Introducing Billion Broadcaster Lift AdvertisingVikasYadav194549
 
Social Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh BendaySocial Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh BendayMaharshBenday
 
Alpha Media March 2024 Buyers Guide.pptx
Alpha Media March 2024 Buyers Guide.pptxAlpha Media March 2024 Buyers Guide.pptx
Alpha Media March 2024 Buyers Guide.pptxDave McCallum
 
Analysis of Sineing Website and how to fix
Analysis of Sineing Website and how to fixAnalysis of Sineing Website and how to fix
Analysis of Sineing Website and how to fixDHARMENDER PRATAP
 
What is Google Search Console and What is it provide?
What is Google Search Console and What is it provide?What is Google Search Console and What is it provide?
What is Google Search Console and What is it provide?riteshhsociall
 
Rise and fall of Kulula.com, an airline won consumers by different marketing ...
Rise and fall of Kulula.com, an airline won consumers by different marketing ...Rise and fall of Kulula.com, an airline won consumers by different marketing ...
Rise and fall of Kulula.com, an airline won consumers by different marketing ...ssusereaa7d9
 
Discover Ardency Elite: Elevate Your Lifestyle
Discover Ardency Elite: Elevate Your LifestyleDiscover Ardency Elite: Elevate Your Lifestyle
Discover Ardency Elite: Elevate Your LifestyleMy Heart Throw Pillow
 
Busty Desi⚡Call Girls in Sector 49 Noida Escorts >àŒ’8448380779 Escort Service
Busty Desi⚡Call Girls in Sector 49 Noida Escorts >àŒ’8448380779 Escort ServiceBusty Desi⚡Call Girls in Sector 49 Noida Escorts >àŒ’8448380779 Escort Service
Busty Desi⚡Call Girls in Sector 49 Noida Escorts >àŒ’8448380779 Escort ServiceDelhi Call girls
 

KĂŒrzlich hochgeladen (20)

Elevating Your Digital Presence by Evitha.pdf
Elevating Your Digital Presence by Evitha.pdfElevating Your Digital Presence by Evitha.pdf
Elevating Your Digital Presence by Evitha.pdf
 
Best 5 Graphics Designing Course In Chandigarh
Best 5 Graphics Designing Course In ChandigarhBest 5 Graphics Designing Course In Chandigarh
Best 5 Graphics Designing Course In Chandigarh
 
Martal Group - B2B Lead Gen Agency - Onboarding Overview
Martal Group - B2B Lead Gen Agency - Onboarding OverviewMartal Group - B2B Lead Gen Agency - Onboarding Overview
Martal Group - B2B Lead Gen Agency - Onboarding Overview
 
Busty Desi⚡Call Girls in Sector 135 Noida Escorts >àŒ’8448380779 Escort Service
Busty Desi⚡Call Girls in Sector 135 Noida Escorts >àŒ’8448380779 Escort ServiceBusty Desi⚡Call Girls in Sector 135 Noida Escorts >àŒ’8448380779 Escort Service
Busty Desi⚡Call Girls in Sector 135 Noida Escorts >àŒ’8448380779 Escort Service
 
Enhancing Business Visibility PR Firms in San Francisco
Enhancing Business Visibility PR Firms in San FranciscoEnhancing Business Visibility PR Firms in San Francisco
Enhancing Business Visibility PR Firms in San Francisco
 
The Science of Landing Page Messaging.pdf
The Science of Landing Page Messaging.pdfThe Science of Landing Page Messaging.pdf
The Science of Landing Page Messaging.pdf
 
Welcome to DataMetricks Consulting (1).pptx
Welcome to DataMetricks Consulting (1).pptxWelcome to DataMetricks Consulting (1).pptx
Welcome to DataMetricks Consulting (1).pptx
 
Press Release Distribution Evolving with Digital Trends.pdf
Press Release Distribution Evolving with Digital Trends.pdfPress Release Distribution Evolving with Digital Trends.pdf
Press Release Distribution Evolving with Digital Trends.pdf
 
Choosing the Right White Label SEO Services to Boost Your Agency's Growth.pdf
Choosing the Right White Label SEO Services to Boost Your Agency's Growth.pdfChoosing the Right White Label SEO Services to Boost Your Agency's Growth.pdf
Choosing the Right White Label SEO Services to Boost Your Agency's Growth.pdf
 
Social Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh BendaySocial Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh Benday
 
FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756
 
Elevate Your Advertising Game: Introducing Billion Broadcaster Lift Advertising
Elevate Your Advertising Game: Introducing Billion Broadcaster Lift AdvertisingElevate Your Advertising Game: Introducing Billion Broadcaster Lift Advertising
Elevate Your Advertising Game: Introducing Billion Broadcaster Lift Advertising
 
Social Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh BendaySocial Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh Benday
 
Alpha Media March 2024 Buyers Guide.pptx
Alpha Media March 2024 Buyers Guide.pptxAlpha Media March 2024 Buyers Guide.pptx
Alpha Media March 2024 Buyers Guide.pptx
 
Analysis of Sineing Website and how to fix
Analysis of Sineing Website and how to fixAnalysis of Sineing Website and how to fix
Analysis of Sineing Website and how to fix
 
What is Google Search Console and What is it provide?
What is Google Search Console and What is it provide?What is Google Search Console and What is it provide?
What is Google Search Console and What is it provide?
 
4 TRIK CARA MENGGUGURKAN JANIN ATAU ABORSI KANDUNGAN
4 TRIK CARA MENGGUGURKAN JANIN ATAU ABORSI KANDUNGAN4 TRIK CARA MENGGUGURKAN JANIN ATAU ABORSI KANDUNGAN
4 TRIK CARA MENGGUGURKAN JANIN ATAU ABORSI KANDUNGAN
 
Rise and fall of Kulula.com, an airline won consumers by different marketing ...
Rise and fall of Kulula.com, an airline won consumers by different marketing ...Rise and fall of Kulula.com, an airline won consumers by different marketing ...
Rise and fall of Kulula.com, an airline won consumers by different marketing ...
 
Discover Ardency Elite: Elevate Your Lifestyle
Discover Ardency Elite: Elevate Your LifestyleDiscover Ardency Elite: Elevate Your Lifestyle
Discover Ardency Elite: Elevate Your Lifestyle
 
Busty Desi⚡Call Girls in Sector 49 Noida Escorts >àŒ’8448380779 Escort Service
Busty Desi⚡Call Girls in Sector 49 Noida Escorts >àŒ’8448380779 Escort ServiceBusty Desi⚡Call Girls in Sector 49 Noida Escorts >àŒ’8448380779 Escort Service
Busty Desi⚡Call Girls in Sector 49 Noida Escorts >àŒ’8448380779 Escort Service
 

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)

Hinweis der Redaktion

  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).