A lexer only breaks the input stream into tokens. They don't count anything so are incomplete for your purpose of computing simple metrics.
If you want to differentiate "functions" from "variables" you'll need some kind of parser to check sequences of tokens to determine what they represent (e.g., "a variable declaration, a use, or a function declaration"). You can build an ad hoc parser that may satisfy your counting needs at the price of making occasional mistakes, or you can get a real parser and do it right. (Parsing a C variable declaration is a lot harder than it looks at first glance; its pretty arcane syntax).
If this is homework, or a real problem and you don't care if the answer is wrong, any lexer generator and ad hoc parsing code will likely do well enough.
If you want to do this accurately, you'll need a preprocessor and a parser, and you'd better look for those (implicitly including a lexer).