I have the following doubts in C++. We know that we can initialize the pointer in the time of declaration as follows:
int *p = new int(8)
cout<<*p<<endl;
This will produce the output as 8. Similarly if we declare a pointer to an integer array:
int *p = new int[10];
And this can be initialized as:
p[0] = 7
p[1] = 9;
But is there any way to initialize at the point of declaration?