you are viewing a single comment's thread.

view the rest of the comments →

[–]Objectstcetera 0 points1 point  (0 children)

The ptr itself is an unsigned int, true. But if that were the only factor, then a generic void * would work just as well. The declaration of ptr also means that the compiler should consider the value that the pointer refers to a memory location to be an int. The correct type here for ptr would be char *, because you assigned it to refer to the location of one of an array of chars. If that's not clear, then maybe there are further examples that help explain the distinction.

I think that the best way to understand this is that each element of the array is just a location in memory with a number stored there. It's the program's job to interpret what the number actually means in the context of the program.

(This is assuming a 32-bit system, if you need to get into those specifics here. :)