IF block not initialize variables

why in if block we can’t declare the variables.
like, if(a==1)
{
int b=0;
}

1 Like

Hi Pankaj
You can declare variables inside if block. The code works perfectly fine. Here. since a is present in if condition, its needs to be declared first.