top | item 33777468

(no title)

poepie | 3 years ago

In the first example a & b are variables, which can be assigned to each other. In the second a & b are pointers, but b is fixed, so you can not assign a value to it.

discuss

order

yakubin|3 years ago

They’re not pointers. sizeof a == 4*sizeof(int), not sizeof(int*).

chipsa|3 years ago

They're pointers, just weird ones. The compiler knows it's an array, so it gives the result of the actual amount of space it takes up. If you passed it into a function, and used the sizeof operator in the function, it'd give `sizeof(int *)`. Because sizeof is a compile-time operation, so the compiler still knows that info for your example.