Having trouble to understand the concept taught in the video

In the last part of the video , prateek tells that pointer a can be overwritten since it’s in the static memory , but array b can’t be overwritten.
I don’t get it, isn’t b also stored in the static memory?

No as b is allocated memory during compile time!(RAM memory used)

a can be overwritten since it’s in the static memory
as a is allocated memory during runtime.(heap/static memory used)

So in what memory exactly are static variables stored?

@chaturvedia336 they are stored in heap memory.

Static variables are stored through compile time allocation , right?

Yes! see the problem is not with the memory but with the type of declaration!
when we declare int b[100], although b is a pointer, but it’s referencing address is fixed and we cannot change it!
but when we do int *b = new int[100], here b is a pointer, which is referenced to a memory address.
So in case 2 you can use b as a normal pointer but in case 1 you cannot.
Hope this helps.

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.