S
sathya_me
Dear clc,
I have a variable void *a; Since variable "a" can be assigned (point
to) any type and also
any type can be assigned to "a" (i.e means "a" = any typed variable;
any typed variable = "a".
Considering the above I have a function, which is declared and defined
to take any type
of parameter with void*
return-type foo (void *a);
In the processes of assignment of value to the variable "a" I want to
check the *type*
of variable "a" at each of assignment with the equality operator.
Like
if(a == INT_TYPE)
some action
if(a == FLOAT_TYPE)
some action
I thought of using sizeof(type). But it varies according to the
system.
<limits.h> #define values are defined to make a range for a variable
but
it does not checks the type. Those macro constants are used only
after we
declare a variable's type.
How can I do this?
Am I missing something basic?
Please explain.
Thanks
--
"Combination is the heart of chess"
A.Alekhine
Mail to:
sathyashrayan25 AT yahoo DOT com
(remove the AT and DOT)
I have a variable void *a; Since variable "a" can be assigned (point
to) any type and also
any type can be assigned to "a" (i.e means "a" = any typed variable;
any typed variable = "a".
Considering the above I have a function, which is declared and defined
to take any type
of parameter with void*
return-type foo (void *a);
In the processes of assignment of value to the variable "a" I want to
check the *type*
of variable "a" at each of assignment with the equality operator.
Like
if(a == INT_TYPE)
some action
if(a == FLOAT_TYPE)
some action
I thought of using sizeof(type). But it varies according to the
system.
<limits.h> #define values are defined to make a range for a variable
but
it does not checks the type. Those macro constants are used only
after we
declare a variable's type.
How can I do this?
Am I missing something basic?
Please explain.
Thanks
--
"Combination is the heart of chess"
A.Alekhine
Mail to:
sathyashrayan25 AT yahoo DOT com
(remove the AT and DOT)