Value and representation are indeed different things. I know that.
Imagine for the sake of argument that instead of void* and int* we're dealing with int and long: the value 42 is valid for both...
Type: Posts; User: qny
Value and representation are indeed different things. I know that.
Imagine for the sake of argument that instead of void* and int* we're dealing with int and long: the value 42 is valid for both...
That is not true.[/QUOTE]
Please see 7.21.6.3 and 7.21.6.1 in the C11 Standard.
7.21.6.3 says that the printf() function behaves like fprintf() (described in 7.21.6.1).
7.21.6.1/8 says that...
Having a a pointer (or a decayed array) and i an int: &a[i] and a + i are exactly the same thing.
The only reason to choose either one is stylistic: I prefer the last one.
Note that, for the...
Lose the j.
Print the address
printf("address is %p\n", (void*)(a + i));