c_-_c_pointers:string_data
C - C++ Pointers - String Data
#include <iostream> using std::cout; using std::endl; #include <string> using std::string; int main() { string string1( "STRINGS" ); const char *ptr1 = 0; ptr1 = string1.data(); for ( int i = 0; i < string1.length(); i++ ) cout << *( ptr1 + i ); // use pointer arithmetic return 0; }
c_-_c_pointers/string_data.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1