SlideShare ist ein Scribd-Unternehmen logo
1 von 38
Computer Science: A Structured Programming Approach Using C 1
11-2 C Strings
A C string is a variable-length array of characters that
is delimited by the null character.
Storing Strings
The String Delimiter
String Literals
Strings and Characters
Declaring Strings
Initializing Strings
Strings and the Assignment Operator
Reading and Writing Strings
Topics discussed in this section:
Computer Science: A Structured Programming Approach Using C 2
FIGURE 11-3 Storing Strings
Computer Science: A Structured Programming Approach Using C 3
FIGURE 11-4 Storing Strings and Characters
Computer Science: A Structured Programming Approach Using C 4
FIGURE 11-5 Differences Between Strings and Character Arrays
Computer Science: A Structured Programming Approach Using C 5
FIGURE 11-6 Strings in Arrays
Computer Science: A Structured Programming Approach Using C 6
A string literal is enclosed in double quotes.
Note
Computer Science: A Structured Programming Approach Using C 7
FIGURE 11-7 Character Literals and String Literals
Computer Science: A Structured Programming Approach Using C 8
FIGURE 11-8 String Literal References
Computer Science: A Structured Programming Approach Using C 9
FIGURE 11-9 Defining Strings
Computer Science: A Structured Programming Approach Using C 10
Memory for strings must be allocated before the
string can be used.
Note
Computer Science: A Structured Programming Approach Using C 11
FIGURE 11-10 Initializing Strings
Computer Science: A Structured Programming Approach Using C 12
11-3 String Input/Output Functions
C provides two basic ways to read and write strings.
First, we can read and write strings with the formatted
input/output functions, scanf/fscanf and printf/fprintf.
Second, we can use a special set of string-only functions,
get string (gets/fgets) and put string ( puts/fputs ).
Formatted String Input/Output
String Input/Output
Topics discussed in this section:
Computer Science: A Structured Programming Approach Using C 13
The string conversion code(s) skips whitespace.
Note
Computer Science: A Structured Programming Approach Using C 14
PROGRAM 11-1 Reading Strings
Computer Science: A Structured Programming Approach Using C 15
Always use a width in the field specification
when reading strings.
Note
Computer Science: A Structured Programming Approach Using C 16
The maximum number of characters to be printed
is specified by the precision in the format
string of the field specification.
Note
Computer Science: A Structured Programming Approach Using C 17
PROGRAM 11-2 Demonstrate String Scan Set
Computer Science: A Structured Programming Approach Using C 18
PROGRAM 11-2 Demonstrate String Scan Set
Computer Science: A Structured Programming Approach Using C 19
PROGRAM 11-3 Delete Leading Whitespace
Computer Science: A Structured Programming Approach Using C 20
PROGRAM 11-3 Delete Leading Whitespace
Computer Science: A Structured Programming Approach Using C 21
PROGRAM 11-4 Read Student Names and Scores
Computer Science: A Structured Programming Approach Using C 22
PROGRAM 11-4 Read Student Names and Scores
Computer Science: A Structured Programming Approach Using C 23
FIGURE 11-11 gets and fgets Functions
Computer Science: A Structured Programming Approach Using C 24
PROGRAM 11-5 Demonstrate fgets Operation
Computer Science: A Structured Programming Approach Using C 25
PROGRAM 11-5 Demonstrate fgets Operation
Computer Science: A Structured Programming Approach Using C 26
FIGURE 11-12 puts and fputs Operations
Computer Science: A Structured Programming Approach Using C 27
PROGRAM 11-6 Demonstration of Put String
Computer Science: A Structured Programming Approach Using C 28
PROGRAM 11-6 Demonstration of Put String
Computer Science: A Structured Programming Approach Using C 29
PROGRAM 11-7 Typewriter Program
Computer Science: A Structured Programming Approach Using C 30
PROGRAM 11-7 Typewriter Program
Computer Science: A Structured Programming Approach Using C 31
PROGRAM 11-8 Print Selected Sentences
Computer Science: A Structured Programming Approach Using C 32
PROGRAM 11-8 Print Selected Sentences
Computer Science: A Structured Programming Approach Using C 33
PROGRAM 11-9 Print File Double spaced
Computer Science: A Structured Programming Approach Using C 34
PROGRAM 11-9 Print File Double spaced
Computer Science: A Structured Programming Approach Using C 35
11-4 Arrays of Strings
When we discussed arrays of pointers in Chapter 10,
we introduced the concept of a ragged array. Ragged
arrays are very common with strings. Consider, for
example, the need to store the days of the week in their
textual format. We could create a two-dimensional
array of seven days by ten characters, but this wastes
space.
Computer Science: A Structured Programming Approach Using C 36
PROGRAM 11-10 Print Days of the Week
Computer Science: A Structured Programming Approach Using C 37
PROGRAM 11-10 Print Days of the Week
Computer Science: A Structured Programming Approach Using C 38
FIGURE 11-13 Pointers to Strings

Weitere ähnliche Inhalte

Was ist angesagt?

Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generation
rawan_z
 

Was ist angesagt? (20)

Intermediate code generation in Compiler Design
Intermediate code generation in Compiler DesignIntermediate code generation in Compiler Design
Intermediate code generation in Compiler Design
 
Java conceptual learning material
Java conceptual learning materialJava conceptual learning material
Java conceptual learning material
 
Compiler unit 4
Compiler unit 4Compiler unit 4
Compiler unit 4
 
17432 object oriented programming
17432   object oriented programming17432   object oriented programming
17432 object oriented programming
 
instruction format and addressing modes
instruction format and addressing modesinstruction format and addressing modes
instruction format and addressing modes
 
Register allocation and assignment
Register allocation and assignmentRegister allocation and assignment
Register allocation and assignment
 
Ch 6 qbank
Ch 6 qbankCh 6 qbank
Ch 6 qbank
 
Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generation
 
Issues in the design of Code Generator
Issues in the design of Code GeneratorIssues in the design of Code Generator
Issues in the design of Code Generator
 
Memory Reference Instructions
Memory Reference InstructionsMemory Reference Instructions
Memory Reference Instructions
 
Pict: A programming language based on the pi-calculus
Pict: A programming language based on the pi-calculusPict: A programming language based on the pi-calculus
Pict: A programming language based on the pi-calculus
 
Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler design
 
C basics
C basicsC basics
C basics
 
A nice 64-bit error in C
A  nice 64-bit error in CA  nice 64-bit error in C
A nice 64-bit error in C
 
Intermediate code representations
Intermediate code representationsIntermediate code representations
Intermediate code representations
 
Ch8a
Ch8aCh8a
Ch8a
 
Types of Instruction Format
Types of Instruction FormatTypes of Instruction Format
Types of Instruction Format
 
Issues in design_of_code_generator
Issues in design_of_code_generatorIssues in design_of_code_generator
Issues in design_of_code_generator
 
Unit iv(simple code generator)
Unit iv(simple code generator)Unit iv(simple code generator)
Unit iv(simple code generator)
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introduction
 

Ähnlich wie Chap 11-1 (20)

Chap-07-1.ppt
Chap-07-1.pptChap-07-1.ppt
Chap-07-1.ppt
 
Variable-intro.pptx
Variable-intro.pptxVariable-intro.pptx
Variable-intro.pptx
 
Chap-02-01.ppt
Chap-02-01.pptChap-02-01.ppt
Chap-02-01.ppt
 
Chap-02-1.ppt
Chap-02-1.pptChap-02-1.ppt
Chap-02-1.ppt
 
Chap-02-1.ppt
Chap-02-1.pptChap-02-1.ppt
Chap-02-1.ppt
 
Chap-02-1.ppt
Chap-02-1.pptChap-02-1.ppt
Chap-02-1.ppt
 
Chap-02-1.ppt
Chap-02-1.pptChap-02-1.ppt
Chap-02-1.ppt
 
Chap-02-1.ppt
Chap-02-1.pptChap-02-1.ppt
Chap-02-1.ppt
 
Chap 02-1
Chap 02-1Chap 02-1
Chap 02-1
 
C programming-1.pptx
C programming-1.pptxC programming-1.pptx
C programming-1.pptx
 
Chapter 02-02.pptx
Chapter 02-02.pptxChapter 02-02.pptx
Chapter 02-02.pptx
 
Chap-02-1.ppt
Chap-02-1.pptChap-02-1.ppt
Chap-02-1.ppt
 
Chap-08-4.ppt
Chap-08-4.pptChap-08-4.ppt
Chap-08-4.ppt
 
Sample Programs.ppt
Sample Programs.pptSample Programs.ppt
Sample Programs.ppt
 
Lecture6
Lecture6Lecture6
Lecture6
 
Cs8251 faq1
Cs8251 faq1Cs8251 faq1
Cs8251 faq1
 
Intro
IntroIntro
Intro
 
Stack implementations
Stack implementationsStack implementations
Stack implementations
 
Chap-03-1.ppt
Chap-03-1.pptChap-03-1.ppt
Chap-03-1.ppt
 
Stack implementation using c
Stack implementation using cStack implementation using c
Stack implementation using c
 

KĂźrzlich hochgeladen

Anamika Escorts Service Darbhanga ❣️ 7014168258 ❣️ High Cost Unlimited Hard ...
Anamika Escorts Service Darbhanga ❣️ 7014168258 ❣️ High Cost Unlimited Hard  ...Anamika Escorts Service Darbhanga ❣️ 7014168258 ❣️ High Cost Unlimited Hard  ...
Anamika Escorts Service Darbhanga ❣️ 7014168258 ❣️ High Cost Unlimited Hard ...
nirzagarg
 
Call Girls In Jp Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Jp Nagar ☎ 7737669865 🥵 Book Your One night StandCall Girls In Jp Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Jp Nagar ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
HiFi Call Girl Service Delhi Phone ☞ 9899900591 ☜ Escorts Service at along wi...
HiFi Call Girl Service Delhi Phone ☞ 9899900591 ☜ Escorts Service at along wi...HiFi Call Girl Service Delhi Phone ☞ 9899900591 ☜ Escorts Service at along wi...
HiFi Call Girl Service Delhi Phone ☞ 9899900591 ☜ Escorts Service at along wi...
poojakaurpk09
 
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
SUHANI PANDEY
 
Whitefield Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Ba...
Whitefield Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Ba...Whitefield Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Ba...
Whitefield Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Ba...
amitlee9823
 
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
amitlee9823
 
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
amitlee9823
 
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
instagramfab782445
 
Editorial design Magazine design project.pdf
Editorial design Magazine design project.pdfEditorial design Magazine design project.pdf
Editorial design Magazine design project.pdf
tbatkhuu1
 
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman MuscatAbortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion pills in Kuwait Cytotec pills in Kuwait
 

KĂźrzlich hochgeladen (20)

Anamika Escorts Service Darbhanga ❣️ 7014168258 ❣️ High Cost Unlimited Hard ...
Anamika Escorts Service Darbhanga ❣️ 7014168258 ❣️ High Cost Unlimited Hard  ...Anamika Escorts Service Darbhanga ❣️ 7014168258 ❣️ High Cost Unlimited Hard  ...
Anamika Escorts Service Darbhanga ❣️ 7014168258 ❣️ High Cost Unlimited Hard ...
 
Call Girls In Jp Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Jp Nagar ☎ 7737669865 🥵 Book Your One night StandCall Girls In Jp Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Jp Nagar ☎ 7737669865 🥵 Book Your One night Stand
 
HiFi Call Girl Service Delhi Phone ☞ 9899900591 ☜ Escorts Service at along wi...
HiFi Call Girl Service Delhi Phone ☞ 9899900591 ☜ Escorts Service at along wi...HiFi Call Girl Service Delhi Phone ☞ 9899900591 ☜ Escorts Service at along wi...
HiFi Call Girl Service Delhi Phone ☞ 9899900591 ☜ Escorts Service at along wi...
 
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
 
Whitefield Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Ba...
Whitefield Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Ba...Whitefield Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Ba...
Whitefield Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Ba...
 
Booking open Available Pune Call Girls Kirkatwadi 6297143586 Call Hot Indian...
Booking open Available Pune Call Girls Kirkatwadi  6297143586 Call Hot Indian...Booking open Available Pune Call Girls Kirkatwadi  6297143586 Call Hot Indian...
Booking open Available Pune Call Girls Kirkatwadi 6297143586 Call Hot Indian...
 
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
 
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
 
Booking open Available Pune Call Girls Nanded City 6297143586 Call Hot India...
Booking open Available Pune Call Girls Nanded City  6297143586 Call Hot India...Booking open Available Pune Call Girls Nanded City  6297143586 Call Hot India...
Booking open Available Pune Call Girls Nanded City 6297143586 Call Hot India...
 
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...
 
Sweety Planet Packaging Design Process Book.pptx
Sweety Planet Packaging Design Process Book.pptxSweety Planet Packaging Design Process Book.pptx
Sweety Planet Packaging Design Process Book.pptx
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
 
Book Paid In Vashi In 8976425520 Navi Mumbai Call Girls
Book Paid In Vashi In 8976425520 Navi Mumbai Call GirlsBook Paid In Vashi In 8976425520 Navi Mumbai Call Girls
Book Paid In Vashi In 8976425520 Navi Mumbai Call Girls
 
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
 
Editorial design Magazine design project.pdf
Editorial design Magazine design project.pdfEditorial design Magazine design project.pdf
Editorial design Magazine design project.pdf
 
Sector 105, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 105, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 105, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 105, Noida Call girls :8448380779 Model Escorts | 100% verified
 
8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available
8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available
8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available
 
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman MuscatAbortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
 
Hire 💕 8617697112 Meerut Call Girls Service Call Girls Agency
Hire 💕 8617697112 Meerut Call Girls Service Call Girls AgencyHire 💕 8617697112 Meerut Call Girls Service Call Girls Agency
Hire 💕 8617697112 Meerut Call Girls Service Call Girls Agency
 

Chap 11-1

  • 1. Computer Science: A Structured Programming Approach Using C 1 11-2 C Strings A C string is a variable-length array of characters that is delimited by the null character. Storing Strings The String Delimiter String Literals Strings and Characters Declaring Strings Initializing Strings Strings and the Assignment Operator Reading and Writing Strings Topics discussed in this section:
  • 2. Computer Science: A Structured Programming Approach Using C 2 FIGURE 11-3 Storing Strings
  • 3. Computer Science: A Structured Programming Approach Using C 3 FIGURE 11-4 Storing Strings and Characters
  • 4. Computer Science: A Structured Programming Approach Using C 4 FIGURE 11-5 Differences Between Strings and Character Arrays
  • 5. Computer Science: A Structured Programming Approach Using C 5 FIGURE 11-6 Strings in Arrays
  • 6. Computer Science: A Structured Programming Approach Using C 6 A string literal is enclosed in double quotes. Note
  • 7. Computer Science: A Structured Programming Approach Using C 7 FIGURE 11-7 Character Literals and String Literals
  • 8. Computer Science: A Structured Programming Approach Using C 8 FIGURE 11-8 String Literal References
  • 9. Computer Science: A Structured Programming Approach Using C 9 FIGURE 11-9 Defining Strings
  • 10. Computer Science: A Structured Programming Approach Using C 10 Memory for strings must be allocated before the string can be used. Note
  • 11. Computer Science: A Structured Programming Approach Using C 11 FIGURE 11-10 Initializing Strings
  • 12. Computer Science: A Structured Programming Approach Using C 12 11-3 String Input/Output Functions C provides two basic ways to read and write strings. First, we can read and write strings with the formatted input/output functions, scanf/fscanf and printf/fprintf. Second, we can use a special set of string-only functions, get string (gets/fgets) and put string ( puts/fputs ). Formatted String Input/Output String Input/Output Topics discussed in this section:
  • 13. Computer Science: A Structured Programming Approach Using C 13 The string conversion code(s) skips whitespace. Note
  • 14. Computer Science: A Structured Programming Approach Using C 14 PROGRAM 11-1 Reading Strings
  • 15. Computer Science: A Structured Programming Approach Using C 15 Always use a width in the field specification when reading strings. Note
  • 16. Computer Science: A Structured Programming Approach Using C 16 The maximum number of characters to be printed is specified by the precision in the format string of the field specification. Note
  • 17. Computer Science: A Structured Programming Approach Using C 17 PROGRAM 11-2 Demonstrate String Scan Set
  • 18. Computer Science: A Structured Programming Approach Using C 18 PROGRAM 11-2 Demonstrate String Scan Set
  • 19. Computer Science: A Structured Programming Approach Using C 19 PROGRAM 11-3 Delete Leading Whitespace
  • 20. Computer Science: A Structured Programming Approach Using C 20 PROGRAM 11-3 Delete Leading Whitespace
  • 21. Computer Science: A Structured Programming Approach Using C 21 PROGRAM 11-4 Read Student Names and Scores
  • 22. Computer Science: A Structured Programming Approach Using C 22 PROGRAM 11-4 Read Student Names and Scores
  • 23. Computer Science: A Structured Programming Approach Using C 23 FIGURE 11-11 gets and fgets Functions
  • 24. Computer Science: A Structured Programming Approach Using C 24 PROGRAM 11-5 Demonstrate fgets Operation
  • 25. Computer Science: A Structured Programming Approach Using C 25 PROGRAM 11-5 Demonstrate fgets Operation
  • 26. Computer Science: A Structured Programming Approach Using C 26 FIGURE 11-12 puts and fputs Operations
  • 27. Computer Science: A Structured Programming Approach Using C 27 PROGRAM 11-6 Demonstration of Put String
  • 28. Computer Science: A Structured Programming Approach Using C 28 PROGRAM 11-6 Demonstration of Put String
  • 29. Computer Science: A Structured Programming Approach Using C 29 PROGRAM 11-7 Typewriter Program
  • 30. Computer Science: A Structured Programming Approach Using C 30 PROGRAM 11-7 Typewriter Program
  • 31. Computer Science: A Structured Programming Approach Using C 31 PROGRAM 11-8 Print Selected Sentences
  • 32. Computer Science: A Structured Programming Approach Using C 32 PROGRAM 11-8 Print Selected Sentences
  • 33. Computer Science: A Structured Programming Approach Using C 33 PROGRAM 11-9 Print File Double spaced
  • 34. Computer Science: A Structured Programming Approach Using C 34 PROGRAM 11-9 Print File Double spaced
  • 35. Computer Science: A Structured Programming Approach Using C 35 11-4 Arrays of Strings When we discussed arrays of pointers in Chapter 10, we introduced the concept of a ragged array. Ragged arrays are very common with strings. Consider, for example, the need to store the days of the week in their textual format. We could create a two-dimensional array of seven days by ten characters, but this wastes space.
  • 36. Computer Science: A Structured Programming Approach Using C 36 PROGRAM 11-10 Print Days of the Week
  • 37. Computer Science: A Structured Programming Approach Using C 37 PROGRAM 11-10 Print Days of the Week
  • 38. Computer Science: A Structured Programming Approach Using C 38 FIGURE 11-13 Pointers to Strings