Dynamic allocation

int *a = new int[1000] ;
cout<<sizeof(a);

output - 8
why is the output 8 ??
and why not 4 ?

Hi @Devansh_29, this is because Size of a pointer is 8 byte on any 64-bit C/C++ compiler,
the answer will be 4 for a 32-bit machine

1 Like

oh okkay, thank you
:smiley:

:+1:, mark your doubt if you have no futher query

1 Like