#include <stdio.h>
int *call();
int main() {
    int *ptr, a = 5;
    ptr = call();
    printf("%d\n", a);
    printf("%d", *ptr);
    return 0;
}
int * call() {
    int x = 25;
    ++x;
    return &x;
}
the above code outputs garbage value after printing the value of a.. but if i remove the printf("%d\n",a); statement then it outputs the value of x. please explain... according to concept of dangling pointer, output should be garbage value . i'm using gcc compiler.
 
     
     
    