Variable names. Scope question.

Can a variable be declared within a function with the same name if it's within the brackets of an if statement?

1
2
3
4
5
6
7
8
9
10
11
12
like 
function()
{
int a

if a = 12 {

int a

}

}
Last edited on
closed account (1vRz3TCk)
Yes, however it is not a wise thing to do, you will soon get confused about witch a you are using.
Topic archived. No new replies allowed.