Live data from Hacker News

How to find size of an array in C without sizeof

arjunsreedharan.org

211–212 of 212 posts

Re: How to find size of an array in C without sizeof

#211
post #17

The printf commands say "the address of..." but proceed to print out the value, not address.

Looks fine to me. An address is just a number, this one being hex encoded.

Okay. In my experience "the address of x" is taken to be synonymous with "&x", but I suppose that's a pedantic difference.

Re: How to find size of an array in C without sizeof

#212

Earlier quoted context omitted.

Looks fine to me. An address is just a number, this one being hex encoded.

Okay. In my experience "the address of x" is taken to be synonymous with "&x", but I suppose that's a pedantic difference.

arr is an array. So printing arr[0] would print the contents within the first position of arr, and &arr[0] would print its address. However if you simply print arr, then that's not the contents of the array, so it will print the address. &arr[0] should print the same as arr.
Post reply on HN