Hello Cboard members,
I have written the following code. I am unable to understand why the returned value is 0 while in the function hi() it is non-zero.
Regards,Code:#include<stdio.h> int* hi(void); int main() { int *Dptr; int n=5; Dptr = &n; printf("\n %u", Dptr); Dptr = hi(); printf("\n %u", Dptr); // Why is this printed 0 on execution ? } int* hi(void) { int *Rptr; int n=5; Rptr = &n; printf("\n %u", Rptr); return &n; }
HitX11