C++ Pointer to String Array

string var friends = {"Amy","John","Joyce","Deszrene","Samson"};string *ptr;ptr = &friends ; // pointer to the 3rd position in arraystd::cout << "Value of friends position 3 = " << *ptr << std::endl; C++ string pointers to specific positions in the string array Other good articles on c++ pointers to string arrays are over here. Feel Free to Copy the code below and test it...
Read More

C++ Pointer to Char Array

C++ Pointer to Char Array examples below. char var = {'1','2','3','\0'};char *ptr; // c++ pointer to a char arrayptr = &var ; // points to the start of the arraystd::cout << "Address of var is " << &var << std::endl;std::cout << "Value of var is " << *ptr << std::endl;Last std::cout will print all the characters starting from position 0. Other users...
Read More
Top