Converting lowercase letters to uppercase letters using a pointer : char pointer « Data Types « C++ Tutorial






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

#include <cctype>
using std::islower;
using std::toupper;

void f( char * );

int main()
{
   char phrase[] = "characters";

   f( phrase );
   cout << phrase << endl;
   return 0;
}


void f( char *sPtr )
{
   while ( *sPtr != '\0' )
   {   
      *sPtr = toupper( *sPtr ); 

      sPtr++; 
   }
}
CHARACTERS








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