I'm little bit confused about how to declare a pointer to array or void*.
let say :
void* myarr[20];
how to declare a pointer to "myarr?"
I'm little bit confused about how to declare a pointer to array or void*.
let say :
void* myarr[20];
how to declare a pointer to "myarr?"
I think you mean a pointer to the first element of an array of pointers to void.
It is simply to do if you will use the following general approach. Let's assume that you have an array of some type T
T myarr[20];
then the definition of the pointer to the first element of the array will look like
T *ptr = myarr;
Now all what you need is substitute T for you particulat type and you will get
void * myarr[20];
void * *ptr = myarr;
If you mean indeed a pointer to the array then approach is the following
T myarr[20];
T ( *ptr )[20] = &myarr;
Or if to substitute T for void * you will get
void * myarr[20];
void * ( *ptr )[20] = &myarr;
typedef void *myarr_t[20];
myarr_t *ptr_to_myarr;
myarr and put it as myarr_t, afterwards I can just say "give me a pointer to type of myarr".void** ptrToArrary = myarr_t; //pointing to base address of array.
arr[10] then arr is arr = &arr[0]void prtToArray = myarr_t[0];