Can I use a variable to name other variables?

The language like 'c' allows the use of same name for two different variables Is it possible for lexical analyser to distinguish between such variables?

  • Answer:

    Using the same name for two different variables in languages like C is possible only within two different scopes, such as outside a block and inside a block... int somevariable; /* outside scope */ { ... int somevariable; /* inside scope */ } In order for a lexical analyzer to distinguish those two variables, it must be able to parse the program and resolve scope the same way the compiler does.

wiki.answers.com Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.