Extract variable definitions and variable use from a C program
Hi! I’m trying to write a ‘C’ program to extract variable definitions and variable use in each line from a input ‘C’ program.
That is, a variable is said to be defined when its value changes(including declarations) and it is said to be ‘used’ when it is referenced. I need to consider this for all the cases and functions(built-in as well as user defined)..
For example consider the following input program
In the line 3, a,b,c are defined and nothing is referenced, hence in line number 3 under the ‘defined’ column a,b,c must be printed, and a mere ‘–‘ should be printed under the ‘used’ column.
Similarly in line 6, ‘a’ is defined and both ‘b’ and ‘c’ are used, hence in defined column a should be printed and under ‘used’ column ‘b,c’ should be printed.
I really don’t know how to start.. can anyone please give me an idea??
Thanks in advance..
|All times are GMT +5.5. The time now is 11:28.|