+3 votes
in Class 12 by kratos

What is the relationship between string and pointers? Give example.

1 Answer

+1 vote
by kratos
 
Best answer

There is a relationship between string and pointers. In C++ string means character array. When a character array is declared then only its first element address is stored. The rest of the elements can be accessed with the help pointer to character array. This is explained with the following example;

Every increment of cptr and printing the value at the location of pointer gives the next element of the character array.

...