why these two programes giving different outputs?
I tried fallowing programs on linux system using gcc compiler, both are
giving different outputs. can any one give detail explanation ? ( request
: don't tell i is global variable kind of answers, give me the details ).
program1:
#include<stdio.h>
int i=10;
int add(){
printf("hai");
i=i+1;
}
void main(){
int k;
k=add();
printf("%d",k);
}
programe2:
#include<stdio.h>
int add(){
int i=10;
printf("hai");
i=i+1;
}
void main(){
int k;
k=add();
printf("%d",k);
}
No comments:
Post a Comment