I want to use the same variable name with a different datatype in C program without casting.
I really wanna do that don't ask why.
So how can I do that ?
And how can I handle the error if this variable doesn't exist while doing prophylactic unsetting ?
You can't. The closest you can get is creating separate scopes and using the same variable name in them:
{
int val;
// do something with 'val'
}
{
double val;
// do something with 'val'
}