825 views

1 Answer

Best answer
3 3 votes

First time when you have declared variable a then compiler has assigned the Garbage Value, which you are printing.

Second time, msg() supposed to return some integer value but you are not returning any actual value hence compiler again returning a Garbage Value, which is going to override last Garbage value. Hence you are getting the different value than first one.

• selected by
Position:
Show:

Related questions

0 0 votes
1 answers 1 answer
913
913 views
radha gogia asked Sep 9, 2015
913 views
char getstr(){ static char s[] = "GATE2016"; return s; } int main(){ printf("%s", getstr()); return 0; }Although I know I am returning an address using a character return...
0 0 votes
1 1 answer
1.5k
1.5k views
radha gogia asked Sep 13, 2015
1,510 views
Say I declare an array likeint abc ;int arr[abc] ;printf("%d",sizeof(arr));Now this abc holds some garbage value so then how come the size of the array is negative value ...