The below code print
The string is : oldstring
I don't understand why?
#include<stdio.h>
char *func(){
char str[1024];
return str;
}
int main()
{
char *g="string";
strcpy(func(),g);
g = func();
strcpy(g,"oldstring");
printf("The string is : %s",func());
return 0;
}