alexan_e
Administrator
So when you have a pointer that points to a block of memory, such as an array or a part of an array, you can treat that pointer ``as if'' it were an array, using the convenient notation. In other words, at the beginning of this section when we talked about *ip, *(ip+1), *(ip+2), and *(ip+i), we could have written ip[0], ip[1], ip[2], and ip. As we'll see, this can be quite useful (or at least convenient).
Absolutely not correct.
I have to disagree, this is standard C behavior.
Can you try the following, they work fine for me in keil uvision (ARM version) and copy the content of array1 to array2
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 char my_array1[] = "test"; char my_array2[5]; char *my_char_p; int main(void) { my_array2[0] = my_char_p[0]; my_array2[1] = my_char_p[1]; my_array2[2] = my_char_p[2]; my_array2[3] = my_char_p[3]; my_array2[3] = my_char_p[4]; while(1); }
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 char *my_char_p = "test"; char my_array2[5]; char *my_char_p; int main(void) { my_array2[0] = my_char_p[0]; my_array2[1] = my_char_p[1]; my_array2[2] = my_char_p[2]; my_array2[3] = my_char_p[3]; my_array2[3] = my_char_p[4]; while(1); }
Alex