I tried the following programs on Linux system using gcc
compiler, both are giving different outputs. Can anyone explain the results?
Program 1:
#include<stdio.h>
int i=10;
int add(){
printf("hai");
i=i+1;
}
void main(){
int k;
k=add();
printf("%d",k);
}
Program 2:
#include<stdio.h>
int add(){
int i=10;
printf("hai");
i=i+1;
}
void main(){
int k;
k=add();
printf("%d",k);
}