I have a C code written in Visual C++ 2010 environment and it compiles without errors.
When I try to debug it, after the line with scanf() function it goes to unknown scope and stops the process of debugging.
How to fix this?

Thanks for replies.

If you look in the call stack, you will see the point at which your code calls scanf. The odds of there being a bug in scanf is tiny. The problem is almost certainly in how you are calling it, so when the crash happens, you need to look at the call stack, select the level at which your code is calling scanf, and examine how you're calling it.