Sign In | Subscribe
Start learning today, and be successful in your academic & professional career. Start Today!
Loading video...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of Introduction to C++
  • Discussion

  • Study Guides

  • Download Lecture Slides

  • Table of Contents

  • Related Services

Bookmark and Share

Start Learning Now

Our free lessons will get you started (Adobe Flash® required).
Get immediate access to our entire library.

Sign up for

Membership Overview

  • Unlimited access to our entire library of courses.
  • Search and jump to exactly what you want to learn.
  • *Ask questions and get answers from the community and our teachers!
  • Practice questions with step-by-step solutions.
  • Download lesson files for programming and software training practice.
  • Track your course viewing progress.
  • Download lecture slides for taking notes.
  • Learn at your own pace... anytime, anywhere!

Handling Strings

  • We’re going to take a closer look at handling character strings.
  • There are two kinds of character strings to deal with, the C++ String Object and the Classic C character array.
  • C++ String is an object, as in object oriented programming. It tends to be easier to use in everyday programming.
  • Classic C String is a null-terminated array of characters, much like any other array.
  • C++ String object overloads operators to allow it to be used in expressions similar to other data types.
  • It also includes member functions used for other processes, such as searching a string for a sub-string, getting string length, etc.
  • We cover some cautions when using Classic C Strings, including cautions using string functions from the standard library.
  • Classic C Strings are till required in certain functions.
  • Here are links to more information about string handling:
    C++ string object library:
    C string standard library:

Handling Strings

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

  • Intro 0:00
  • Overview 0:09
  • Two Kinds of Strings 2:21
    • Object String from C++
    • Classic Strings from C
  • C++ String Object 4:24
    • Useful Member Functions
  • String Object Examples 7:35
    • Initialization
    • Operations
  • String Object Member Functions 10:27
    • Member Function
    • Example
  • More Member Functions 13:34
  • Arrays of String Objects 16:18
    • Examples
  • Classic C Character String Array 19:00
    • Defined As
    • Useful Functions for C-String Operations
  • Array of Classic C String 22:00
    • Examples
  • Some Reasons Against Classic 24:36
    • Examples
    • Need to Use String Functions
  • Cautions with Classic C Strings 26:11
    • Examples
    • Especially with Copying and Concatenation
  • But You Can't be Rid of It 29:35
    • Examples
  • Don't Tangle Your Strings! 32:30