logoalt Hacker News

rocquatoday at 1:24 PM2 repliesview on HN

That depends on sizeof(*arr) no?


Replies

unwindtoday at 1:38 PM

Not in C no, since arithmetic on a pointer is implicitly scaled by the size of the value being pointed at (this statement is kind of breaking the abstraction ... oh well).

messetoday at 2:22 PM

Nope, a[b] is equivalent to *(a + b) regardless of a and b.

show 1 reply