top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Any way to output variable names with their size (i.e. int, char etc.) in a C?

+4 votes
334 views

I am wanting to extract variable names and their size (int, char and etc.) from a c file.
Is there any way to extract that type of information?

posted Jan 10, 2014 by Meenal Mishra

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Those are types, not sizes. A variable's type is a property of the source code, the size of that type depends on the compiler and target platform.

You could compile it and look at the debug info. Or write a GCC plugin to output the info as the file is compiled.

answer Jan 10, 2014 by Satish Mishra
...