Question #88756

How is pointer different from ordinary variable? What is the output of the following program segment ?

#include <in stream. h>
void main ( )
{

char *st="Beautiful "
st++;
cout <<st <<endl;
st+=2
cout <<st <<endl;
}

Expert's answer

The difference between a variable and a pointer is that the variable stores the value, and the pointer stores the address of another variable.

Output of this program:

eautiful

utiful


LATEST TUTORIALS
APPROVED BY CLIENTS