1 / 7

C ++ Beginner Tutorial 10

One Stop Programming . Cap-Stone Project. C ++ Beginner Tutorial 10. Null Terminated Strings. String “Hello World” in memory: Note the last character is ’ ’. This indicates the end of the string in memory and must be factored into the size of the array.

george
Download Presentation

C ++ Beginner Tutorial 10

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. One Stop Programming Cap-Stone Project C++ Beginner Tutorial 10

  2. Null Terminated Strings • String “Hello World” in memory: • Note the last character is ’\0’. This indicates the end of the string in memory and must be factored into the size of the array. • The length of the string “Hello World” is 11 characters. However, this size is 12. Make sure to accommodate this when building your functions. • It is possible to check if the character at an index is a null termination character. Ex: if(str[3] == ‘\0’).

  3. Cap-Stone Project Develop the three functions below according to each of their requirements. A template file is provided to help you get started: • intcountChar(char str[]) • Counts the number of characters in a string. Does not include null termination character. • Example: “hi” has 2 characters, “The dog.” has 6 characters, and “” has zero characters. • void removeSpaces(char str[]) • Removes spaces from a string and then prints the string with no spaces. • Example: “Hello world” prints “HelloWorld” • void reverseChar(char str[]) • Prints the string backwards starting from the last character in the string. • Example: “The red fox” prints “xof der ehT”

  4. Template And Solution Provided • Download the template and solution from: http://onestopprogramming.com/blog/?page_id=2

  5. More Detail - 1

  6. More Detail - 2

  7. Good Luck!

More Related