#include <stdio.h>
#include <conio.h>
int f(int a){
int i,f=1;
for(i=1; i<a; i++)
f=f*i;
return f;
}
void main(){
int k;
clrscr();
int (*u)(int);
u=&f;
printf("%d", u);
getch();
}
The above code prints 657 on TurboC++ and the output doesnt change with time, So is it not Garbage value?
#include <stdio.h>
int f(int a){
int i,f=1;
for(i=1; i<a; i++)
f=f*i;
return f;
}
int main(){
int k;
int (*u)(int);
u=&f;
printf("%d", u);
return 0;
}
And this modified version of the code, returns:
4199220 on CodeBlocks
4199728 on DevC++
134521824 on OnlineIDE
134513824 on gcc 4.9.2
And these values don't seem to change with different runs. The output of course is Compiler dependent but Please explain how this output is generated?