const char* returnStr()
{
char time[40] = {"France"};
char* time1;
time1 = time;
return time1;
}
int main(int argc, char* argv[]) {
printf ("return String is %s\n",returnStr());
}
This code returns some junk characters. Won't the const char* not enough to return the local char pointer? Do I have to use the static too in the function?