Python "why" questions
Roald de Vries
downaold at gmail.com
Sun Aug 15 13:55:10 CEST 2010
On Aug 15, 2010, at 1:00 PM, Lawrence D'Oliveiro wrote:
> It would be if pointers and arrays were the same thing in C. Only
> not, quite. Which somewhat defeats the point of trying to make them
> look the
> same, don’t you think?
How are they not the same?
The code snippet (in C/C++) below is valid, so arrays are just
pointers. The only difference is that the notation x reserves space
for 4 (consecutive) ints, and the notation *y doesn't.
int *y = x;
Moreover, the following is valid (though unsafe) C/C++:
int y = x;
More information about the Python-list