Has a way to get the datatype in C?

For example:

```

int foo;

if (foo is int)
{
    // do something
}

```

or something like:

```

if (typeof(foo) == typeof(int))
{
    // do something
}

```

Thanks in advance.
['https://Stackoverflow.com/questions/5127797', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/464230/']
This is called type introspection or reflection and is not supported by the C language. You would probably have to write your own reflection library, and it would be a significant effort.
The fact that `foo` is an `int` is bound to the name `foo`. It can never change. So how would such a test be meaningful? The only case it could be useful at all is in macros, where `foo` could expand to different-type variables or expressions. In that case, you could look at some of my past questions related to the topic:

[Type-generic programming with macros: tricks to determine type?](https://stackoverflow.com/questions/4331474/type-generic-programming-with-macros-tricks-to-determine-type)

[Determining presence of prototype with correct return type](https://stackoverflow.com/questions/4483757/determining-presence-of-prototype-with-correct-return-type)