I am using Keil Micro Vision4 for ARM 9 Processor .the Local variables appears "Out of scope" How do i monitor the local variables
When you tell the compiler to optimize code, then the compiler really will optimize the code. So it will convert some local variables into registers. And it may reuse same register for multiple local variables. Or move the local variable between different registers for different parts of the code based on what produces most efficient code.
And it will detect local variables that are no longer used (even if there exists more assigns to them or following expressions makes use of them but don't produce any side effects later used) and then quickly reuse the registers for other things.