Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C halps

Name: Anonymous 2008-03-19 17:18

How do I check what type of variable a variable is?

Something like;
if (typecheck(foo,int))
  {
  /* lol */
  }

Name: Anonymous 2008-03-20 2:51

Simply, you cannot do it.
sizeof won't work, because sizeof (short) might be 1, or sizeof (float) == sizeof (long).
It's simply impossible just with the size.
Also, sizeof (size_t) might be 4 in your system but 128 in others.

one thing you can do if you know you work with integers and pointers only is to use intmax_t, but I'm not sure if that is what you were looking for.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List