C++ char array Prints strings pointed to by an array.

Description

C++ char array Prints strings pointed to by an array.

#include <iostream>
using namespace std;
void main()// ww  w .j  a v  a2 s .  co m
{
   char *name[5]={ {"George"},{"Michelle"},{"Joe"}, {"Marcus"},{"book2s.com"} };
   int ctr;
   for (ctr=0; ctr<5; ctr++)
   {
      cout << "String #" << (ctr+1) <<" is " << *(name+ctr) << "\n";
   }
   return;
}



PreviousNext

Related