Following are two programs which behave differently for same situtaion.
Code:
#include<stdio.h>
char *somfun()
{
char *t="pawan";
return t;
}
int main()
{
puts(somfun());
}
Code:
#include<stdio.h>
char *somfun()
{
char t[]="pawan";
return t;
}
int main()
{
puts(somfun());
}
Both variable inside function "somfun" are having local scope even after that first program is printing the value of t...how is it possible???????

