Simple parser - K&R ex6-2

Hi everyone, I'm trying to solve problem 6-2 from the K&R book.
I need to identify the variable names in a c source file, what is the best approach to this problem?
Do I have to write a simple parser or can I get away with something simpler?
I just don't want to skip the exercise but right now it seems a bit daunting to me.
Thanks,
Luca

>I'd like variable declarations to be wherever they can be.
Are you sure ?
Most compilers still do not support that. (And many in the C realm will scoff at that...)
...If you are sure, then the simplest way I can think of is to read the whole code and filter out the words which are not keywords, operators, punctuations...etc.