I declared local variable b
in function count
, and local variable b
in function count2
, I thought they are different variables, but variable b
in count2
still hold the same value , what is happening here ? Can someone explain it to me please?
#include<stdio.h>
int a;
int count2() {
int b ;
printf ("\n value of b2 variable for second time is : %d ",b);
}
int count() {
int b = 2;
b++;
printf ("\n value of b variable is : %d ",b);
b = 99;
}
int main() {
printf ("value of a variable is : %d ",a);
count();
count2();
}