I'm doing C programming and need help with this problem..
char str[] = "Hello";
char * ptr = str;
char ** ptr2 = (char**)ptr;
I have these three lines in a header file. The first two lines are fine but an error will occur in the third line. Explicitly the error is "initializer element is not constant".
Is there any other way of assigning the address of ptr
to *ptr2
globally? Or is this impossible to achieve globally?
I want this done so ptr2
can be the common access point but what it's pointing to can be changed if necessary.