chellappa said:
Hi All,
How to find the data type of the variable ?
The C language does not have a facility for doing this.
is there any libaray
function avaiable? Because i want create generic data type of some
operation .
When you create an object, you know its type. E.g.:
int i;
double d;
If you keep track of this information yourself (e.g. with
a 'type flag' or such), you can implement 'generic' types
using a pointer to void (type 'void *'). Use a 'type
flag' to convey type information to a function. This is
how 'printf()' does it (e.g. "%d" in the first argument
tells it that the associated argument is type' int). Of
course things won't work if you don't actually pass the
proper type. IOW, 'void*' is quite useful, but needs
to be used with great care. A sharp, two-edged knife.
-Mike