somy question is, **Is there two variable named x in the main ,one goes to g() with value 1 go there prints 2 and another one keeps at 1 again prints 2 in main. **
#include <stdio.h>
void f(){
extern int x;
x++;
printf("%d",x);
}
int x;
void g(){
++x;
printf("%d",x);
}
int main() {
// Write C code here
x++;
g();
printf("%d",x);
return 0;
}
Output : 22
xin the shown code. It's initialized to zero by the system (global non-constant variables are always "zero" initialized). It's increased to1in themainfunction. It's increased to2in thegfunction. Thegfunction prints its value. Then themainfunction print its value.