Timeline for About array names and addresses of arrays in C
Current License: CC BY-SA 2.5
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 3, 2010 at 6:49 | vote | accept | S..K | ||
| Dec 3, 2010 at 1:59 | comment | added | T.T.T. | Why don't we have to de-reference the pointer array "a[1]" to get value 213? | |
| Dec 2, 2010 at 23:28 | comment | added | S..K | @above : my apologies. I intended to mean arr and not a. Thank you for clearing my doubts and may I assume this is what you have meant in the last line of your answer regarding sizeof() ? | |
| Dec 2, 2010 at 23:21 | comment | added | aschepler | @S..K: a or arr? If those are the same identifiers as in your code, it makes a difference. Assuming you meant arr, or that a is really an array, this is because the array-to-pointer conversion does not happen in sizeof, so it can give a useful size of an array. In the second case, sizeof is giving the size of a pointer. | |
| Dec 2, 2010 at 23:15 | comment | added | S..K | When I do sizeof( a ) i get 4 * 2 = 8 . However doing sizeof( &a ) gives me 4 . Why is it so ? | |
| Dec 2, 2010 at 22:11 | history | answered | aschepler | CC BY-SA 2.5 |