??? 05/27/05 15:20 Read: times |
#94009 - const pointer Responding to: ???'s previous message |
Bartosz Wucke said:
It's always noted (where applicable) that Array notation is equivalent to const pointer. That is, you can't assign to the pointer, only to the object pointed to. So it seems only the allocation rule applies here.
void main( void ) { char my_array[] = "Array"; const char *my_pointer = "Pointer"; ... This way my_array=my_pointer; is just as illegal as my_pointer=my_array; You might be surprised if you add the line: my_pointer=my_array; to your example above and compile it. |
Topic | Author | Date |
Unions in C | 01/01/70 00:00 | |
You miss the point completely... | 01/01/70 00:00 | |
Easy with Union | 01/01/70 00:00 | |
You can see from the Raghu example... | 01/01/70 00:00 | |
Platform-dependence | 01/01/70 00:00 | |
Padding in unions | 01/01/70 00:00 | |
portability | 01/01/70 00:00 | |
array=pointer...? | 01/01/70 00:00 | |
array != pointer | 01/01/70 00:00 | |
Quirk of C | 01/01/70 00:00 | |
Read the FAQ | 01/01/70 00:00 | |
Read the Comment | 01/01/70 00:00 | |
Read everything | 01/01/70 00:00 | |
Looks the same to me | 01/01/70 00:00 | |
This One | 01/01/70 00:00 | |
That's the problem | 01/01/70 00:00 | |
Good example | 01/01/70 00:00 | |
No fun | 01/01/70 00:00 | |
Well... | 01/01/70 00:00 | |
Of course it does! | 01/01/70 00:00 | |
Hmm | 01/01/70 00:00 | |
Actually, even less. | 01/01/70 00:00 | |
const pointer | 01/01/70 00:00 | |
O.K you win | 01/01/70 00:00 | |
Please conclude | 01/01/70 00:00 | |
Not Exactly | 01/01/70 00:00 | |
End of wrong stick?![]() | 01/01/70 00:00 |