We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hopefully this makes sense. I've cut down the actual code to make this short. I have a series of strings as shown:
char code Num1[] = {"One "}; char code Num2[] = {"Two "}; char code Num3[] = {"Three"};
code char code *CHNLTable[] = { Num1, Num2, Num3};
void func(void){ unsigned int *myptr; myptr = &CHNLTable; ...code that uses myptr }
I think everyone will agree with Walt Conley: CHNLTable[] is an array of pointers. '&CHNLTable' is equivalent to 'CHNLTable' as well as '&(CHNLTable[0])'. That is, '&CHNLTable' is a pointer to the first element of the array and it has the type 'char code**'. So if you want to convert it to pointer to int (for whatever reason), use 'int* myptr = (int*)&CHNLTable;'. Actually, it's all well described in K&R. Reading this book can only do good. Hopefully, I didn't mess up here :-)) Regards, Mike
That is, '&CHNLTable' is a pointer to the first element of the array and it has the type 'char code**' I think this is too imprecise. &CHNLTable is the address of CHNLTable. Jon
I only ment that address of array is a pointer to the first element of the array (in terms of both type and actual binary value). Actually, that is how I would define the term 'address of array'.
Yes, however, a pointer has an address whereas an address does not. Jon