are pointers of integer or unsigned datatype?
-
2Integer and unsigned are not mutually exclusive. – Oct 20 '10 at 09:34
-
In fact, only integral types can be unsigned. Neither pointer types nor floating-point types can be unsigned. – MSalters Oct 20 '10 at 10:39
7 Answers
No. They're pointers, whose size is system-dependent and whose only compatible type is void*
.

- 776,304
- 153
- 1,341
- 1,358
-
-
There has to be a compatible integer type, although which one is implementation-defined, such that you can convert a data pointer to it and back again and have the same pointer. – David Thornley Oct 20 '10 at 13:51
-
1MSalters : `char *` as a generic pointer is deprecated usage isn't it? – Noufal Ibrahim Oct 20 '10 at 13:51
-
David : I think it's `int_ptr` which should be available on all platforms abstracting away the platform specific details. – Noufal Ibrahim Oct 20 '10 at 13:52
-
4
-
@Secure POSIX, on the other hand, requires them to be so. (We can haz `dlsym()`, can't we.) – Jul 13 '13 at 08:14
-
2Pointer types other than `void*` are not *compatible* with `void*`. The existence of an implicit conversion is not the same thing as type compatibility, which is rather narrowly defined. – Keith Thompson Jul 13 '13 at 09:33
-
3@H2CO3: `intptr_t` and `uintptr_t`, defined in `
`, are optional. A conforming implementation with no integer types big enough to old a converted `void*` value without loss of information will not define them. (I know of no such implementations, but they're possible.) – Keith Thompson Jul 13 '13 at 21:51
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.

- 119,563
- 19
- 122
- 198
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
.

- 2,208
- 2
- 19
- 32

- 49
- 1
I believe pointers itself are data types. This belief of mine came from the book written by Brian Kernighan and Dennis Ritchie 2nd edition from Introduction part stating that -
BCPL and B are "typeless" languages. By contrast, C provides a variety of data types. The fundamental types are characters, and integers and floating point numbers of several sizes. In addition, there is a hierarchy of derived data types created with pointers, arrays, structures, and unions.
Please discuss or share your views.
Reference - c programming language by dennis ritchie

- 450
- 4
- 5
int *p;
data type of *p is pointer. And it points to integer type variable. It stores address in hexadecimal format.
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.

- 1,149
- 1
- 6
- 19
-
2
-
what do u mean by pointers are pointers, could you explain a little more on that statement? what i mean was an address cant be negative, so it must be an unsigned integer. – Raju Jul 14 '13 at 07:54
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.
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.
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).

- 10,591
- 9
- 64
- 104