I wish this help you You can dereference it, it is just that the result is not going to be what you'd expect: *arr is not an int, it's a pointer to an int (OK, a one-dimensional array). If you want to see 1 printed, add another star:
Hope this helps In this case, the answer is no -- since you simply defined array (didn't use something like malloc to allocate it) you don't have to do anything to free it either. If it was local (defined inside a function) it'll be freed automatically when you exit the function. If you defined it outside any function, it's a global, so it'll exist the entire time the program runs. Either way, you don't have to d any explicit memory management.
Assign and dereference void * to an array pointer in C
like below fixes the issue I have a pointer to array of fixed size integer elements. After populating that array, I assigned it to void *pBuff. Later on, I need to access array elements through void pointer which I failed in doing so. , Apart from the fact that you need to use:
pBuff = pPB;
Why in C++, I don't need to dereference a pointer to an array in order to access items in the array
it helps some times I'm currently learning pointer. And when I create a pointer to an array with int type, I found that I can directly index the pointer without deferencing the pointer and the compiler still output exact items in my array. I do not understand why this works and why we don't need to first deference the pointer. , Code that without dereference
[ code ]
theArray[i] = i;
*(theArray+i) = i;
*p = q;
p = q;
how to understand that dereference a pointer to array get a pointer to element?