What is pointer to object type in C?

10,357

I think the text mentioning "pointer to object type" is talking about the type representing a "pointer to object", i.e. a pointer to something.

Does this mean that the object where 10 is stored saves information about the type of value stored in the object

Type information of variables that you declare in C is relevant only during the process of compiling your program. Once your program has been compiled, type information is gone. There is no type information to store in memory at runtime.

Here is one place where C99 standard mentions "pointer to object type":

6.5.2.1 Array subscripting

One of the expressions shall have type "pointer to object type", the other expression shall have integer type, and the result has type "type"

What this means is that the pointer expression has to be a pointer to data object of a specific type. It cannot be a pointer to function, or a pointer to data with no specific type (i.e. void*).

Share:
10,357
Jin
Author by

Jin

Hello? I have just started learning C. When I get familiar with C, I'm planning to learn other languages such as C++, Java, Javascript, etc.

Updated on June 24, 2022

Comments

  • Jin
    Jin almost 2 years

    For example,

    int x = 10;
    

    Then the value 10 is saved somewhere in the memory. I have heard of "pointer to int object", but I have never heard of "pointer to object type". Does this mean that the object where 10 is stored saves information about the type of value stored in the object and value of "pointer to object type" shows where this information is stored in memory?