Previous Slide Accessing via Array or Pointer Next Slide

Then, either the original array or a pointer to it can be used to access the string's contents:
cout << "label is " << label << endl;
cout << "label is " << labelPtr << endl;

cout << "3rd char is " << label[2] << endl;
cout << "3rd char is " << labelPtr[2] << endl;


BU CAS CS - Manipulating Strings - Lab
Copyright © 1993-2000 by Robert I. Pitts <rip@bu.edu> All Rights Reserved.