What is the datatype of pointer in c?

后端 未结 6 2023
别那么骄傲
别那么骄傲 2021-02-04 08:56

are pointers of integer or unsigned datatype?

相关标签:
6条回答
  • 2021-02-04 09:34

    Pointers to any datatype either it may be of char/int/float/double/... are unsigned integers only.

    Reason: Since a pointer stores the address, which is a location in computer memory, it's always positive,can't be negative.

    0 讨论(0)
  • 2021-02-04 09:35

    What is the data type of pointer in C? is the unique question.

    One should not deviate from the question to give any kind of explanation on pointers as the answwer to the question?

    Answer.

    1. What is the data type name of a set of intergers in C? The name is int , which is the name of the set comprising of all the permissible integers. Hence we declare int x; where x can assume any value from the set.

    2. Similarly , What is name of the set of all the permissible addresses or pointers? .The set name can only be the character '*' as I fathom, though no explanation is seen anywhere in C language narratives.

    Hence we declare the pointer variable as *x; where * is the data type name. Otherwise why should a pointer data type is thought about and brought under the user defined data type. Since there are all the RAM cells, the '*' data type forms a subset of permissible and accebile memory cells. Hence this is a data type name of a set of pointers.

    The int is the modifier as in signed char c; where signed is the modifier in C.Hence we may have int *x; to mean that data in the location is an integer which is a necessary information for the compiler.

    C speaks about pointer data type as the user data type. Perhaps it is wrong to consider the pointer data type as the user data type since the user has no control over the set of pointers in the set, going by the basic concept of int is the set name, float is the set name, char is the set name of haracters, double is the set name of floats of high precision numbers, colour is the data type name in enum colour = { blue, red, yellow).

    0 讨论(0)
  • 2021-02-04 09:49

    No. They're pointers, whose size is system-dependent and whose only compatible type is void*.

    0 讨论(0)
  • 2021-02-04 09:49

    In C, pointer can access the variables of any data types. The pointer should be declared with the data type of the variable the pointer will be pointing. To print the address of the pointer in hexadecimal format use %p and to print the address in other forms use %u.If the pointer is going to be used to display value of pointing variable, use *pointer_name and just for address use pointer_name.

    0 讨论(0)
  • 2021-02-04 09:50

    Pointers are of pointer type. If you're asking about how pointer values are represented in memory, that really depends on the platform. They may be simple integral values (as in a flat memory model), or they may be structured values like a page number and an offset (for a segmented model), or they may be something else entirely.

    0 讨论(0)
  • 2021-02-04 09:50

    int *p;

    data type of *p is pointer. And it points to integer type variable. It stores address in hexadecimal format.

    0 讨论(0)
提交回复
热议问题