Some doubts in dynamic Memory allocation

In the following lines of code:
int *p=new int(30);
cout<<*p;
int *arr=new int[30];
cout<<arr[0]<<endl;
Why didn’t we put * before arr[0] just like we did for the variable p?
Please help…

@Tiwary725 It is because *p and *arr both are pointers.
When we use *p it means that we want to use the value present at address which is pointed by pointer p.
Whereas we use arr[0] because arr contains the base address of the integer array and we go to the 0th location using arr[0] and find the value .

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.