Re: how to get the data type of a veriable



Uzytkownik <sunil.reloaded@xxxxxxxxx> napisal w wiadomosci
news:1121602609.264199.92540@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Consider that a variable is defined as int in the beginning of the
> program.
>
> Say, int ver1;
>
> It is a very lengthy program hence i want to know the type of the
> varable ver1 in the middle of the program(Assume in some function).
>
> Can you tell me how do i get the type of the variable that was defined
> previously???
>
>

Why do you bother to do so?
Is it too hard to scroll up in whatever your editor is?
Or to use "search" function?

And that condition for checking if simple variable
is of certain type and forking flow of the program
depending on the type of variable that is well-known
to be of certain type looks very strange

Certain languages like object pascal (and c++ to some degree)
have RTTI (run-time type info) but it has applications in oop
and when you deal with polymorphism.

But not in C.

I think in your problem just scrolling up or defining the variable
more locally would do.

--
Regards,
Krzysiek


.