Aliasing of arrays

we can ONLY do aliasing of dynamic array right ?

hello @prerak_semwal

u can do with static as well .
u can assign base address of static array to some pointer and then use that pointer.

int a[5]={1,2,3,4,5}
int *b=a;
now u can use b to acceess content of array a.

1 Like

@aman212yadav
I don’t want to alias… I just want to create a copy of ‘a’ and initialize ‘b’

then that is not aliasing .

u need to create seprate array of same size and then copy content to that new array.

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.