Printing a string one character at a time using a pointer : char pointer « Data Types « C++ Tutorial






#include <iostream>
using std::cout;
using std::endl;

void f( const char * );

int main()
{
   const char phrase[] = "a string";

   f( phrase );
   return 0;
}

void f( const char *sPtr )
{
   for ( ; *sPtr != '\0'; sPtr++ )
      cout << *sPtr;
}
a string








2.21.char pointer
2.21.1.Reverse string case using pointer arithmetic
2.21.2.Printing the address stored in a char * variable
2.21.3.Display value of char *, then display value of char static_cast to void *
2.21.4.Converting lowercase letters to uppercase letters using a pointer
2.21.5.Printing a string one character at a time using a pointer