What is the data type of pointer variables?

前端 未结 7 1354
栀梦
栀梦 2020-12-29 12:59

I refereed the following link,

Link1 Link 2

In the above link1 it was mentioned in answer that \"Pointers are of pointer type\".

I jus

7条回答
  •  一生所求
    2020-12-29 13:41

    For example in the C Standard there is no formal definition of the term data type. There are object types and function types. At the same time pointers are derived types constructed from object and function types.

    Thus in general case pointers are data types that is they are data types that are constructed from object and function types.

    Also there is definition of term object in the C Standard

    3.15
    1 object
    region of data storage in the execution environment, the contents of which can represent
    values
    

    So there is some contradiction in the Standard. On the one hand pointers are objects because they occupy memory and the memory represents their values. So we may say that pointers are object types. On the other hand pointers are considered as derived types from object types.

    In my opinion it would be better if there would be explicitly written in the Standard that pointers are derived object types or derived function types.

    In any case you may bravely say that pointers are data types!:)

提交回复
热议问题