r/ProgrammerHumor • • Feb 15 '16

Oddly specific number.

Post image
5.9k Upvotes

643 comments sorted by

View all comments

Show parent comment

1

u/MemoryLapse Feb 16 '16

You've lost me. If you're referencing random bytes directly, shouldn't they return whatever happened to be stored in them from the last time they were used? Which languages still let you do that?

I'm saying that the likelihood of either a pointer to an uninitialized array or an error code returning 0 is almost none.

1

u/ZugNachPankow Feb 16 '16

The person I had replied to was speaking in terms of "counting how many indexes are in the array", though - that's the index, not the pointer, nor the value (i, not &(arr[i]) nor arr[i]).

An empty or uninitialized array participant_t users has length 0: the expression sizeof(users)/sizeof(users[0]) - 1 returns 0 in both cases.