A pointer isn't a data type. A pointer is a reference to a specific memory cell that holds data of some sort.
2007-03-06 15:51:09
·
answer #1
·
answered by Anonymous
·
0⤊
1⤋
We can assign the address of any variable and constants to the pointer. The data type of the variable doesn't matter. But the address is the type of the int, because it is only 2 bytes. So the pointer is the int type according the memory, according to the programming the pointer is depending upon the data type as declared.
char *s;//depending on char data type
int *p;////depending on int data type
//but storage of pointer should be in int data type.
2007-03-06 23:53:32
·
answer #2
·
answered by sridhar b 2
·
0⤊
0⤋
pointers are generic
generic in the sense that they can be used to with any of the data types
and the data type associated with the pointer denote the data type of the variable to which the pointer is pointing to
2007-03-07 03:00:36
·
answer #3
·
answered by sweetboy 3
·
0⤊
0⤋
The type actually is the type to which the pointer points or directs . But it can be considered as "unsigned integer" because it stores an address of a memory location which is an unsigned integer.
While declaration a pointer is declared with the data type of the type to which it would be pointing, for eg.
int m, *ptr;
ptr=&m;
here, ptr will point to a integer variable.
But when we outpot the value stored in a pointer the format string used is "u" which is used for "unsigned integer", for eg.
printf("%u",ptr);
It's just as simple as that!
2007-03-07 08:05:13
·
answer #4
·
answered by cool_chunks 3
·
0⤊
0⤋
pointer(*) doesn't belongs to particular data type,data type of pointer will be data type with which it is declared.
for example:
declaration --- data type
int *pointer; --- int
float *pointer; --- float
char *pointer --- char
when u go to c++,pointer can be declared as data type of void,for example like this:void *pointer;.here pointer can point to variable of any data type as pointer stores only references which occupy 2bytes.
for example like this
void *pointer;
int number,value
number=2;
(int *)pointer=&number;
value=*(int*)pointer;
Actually pointer is reference variable,stores the address of the another variable which is of same data type of pointer.As value of a ordinary variable can be changed, so as the reference to which pointer is pointing can also be changed.
2007-03-06 23:45:48
·
answer #5
·
answered by gurukanth 1
·
0⤊
0⤋
Pointer is not have any data type... its just a pointes to a memmory location.
2007-03-07 03:50:39
·
answer #6
·
answered by Tom 2
·
0⤊
1⤋
For all those who answered this question,
for int 2 bytes and for float 4 bytes are requierd to store data.
if pointer is of float type it requires 4 bytes to store its address?
or if its char datatype it requires only 1 byte to store address ?
*********
its unsigned int
remember we are using %u to print address stored in pointer
-
PC
2007-03-07 02:11:38
·
answer #7
·
answered by PC 4
·
0⤊
0⤋
Pointer is of VOID data type...
where it gets typecasted to the PRIMITIVE DATATYPE (int,float,char.....) or to the User Defined datatype( in case of NOde in linked list in tree)........
Its can be used according to needs.....of programmer.......
2007-03-06 23:54:14
·
answer #8
·
answered by Mani 2
·
0⤊
1⤋
Depends on what it points to I guess, or it could be of type void.
2007-03-06 23:40:41
·
answer #9
·
answered by BigRez 6
·
1⤊
1⤋
pointer is a integer datatype.
2007-03-07 01:20:44
·
answer #10
·
answered by siri 1
·
0⤊
1⤋