Jul 12, 2008 at 9:11pm Jul 12, 2008 at 9:11pm UTC
Yep. They are pointers to arrays.
Arrays are only considered the same size depending on what you mean by "size". They may occupy the same number of bytes in memory, or they may have the same number of elements. (Since the above is neither, then they are all disparate sizes.)
Hope this helps.
Jul 12, 2008 at 9:15pm Jul 12, 2008 at 9:15pm UTC
No, I disagree with Duoas; a1, a2 and a3 aren't arrays but I agree that they are not the same size.
all you have is three lumps of memory that are the size of 4, 3, and 5 ints.
You could use them as arrays or store any data type or structure in these memory areas.
Last edited on Jul 12, 2008 at 9:31pm Jul 12, 2008 at 9:31pm UTC
Jul 12, 2008 at 9:56pm Jul 12, 2008 at 9:56pm UTC
I didn't say that a1, a2, and a3 are arrays. I said that they point to arrays.
An array is only an array when treated as if it is an array. C and C++ give us the option of choosing how many items a pointer references.
;-)
Jul 13, 2008 at 12:44am Jul 13, 2008 at 12:44am UTC
Whew. I was worried for a moment there that my brain wasn't working right. I hate it when it does that. (Or is it "when it doesn't that"?)
:-P