What is the output of this program?
#include
#include
int main()
{
int i;
char *ptr;
char *fun();
ptr = fun();
printf(" %s", ptr);
return 0;
}
char *fun()
{
char disk[30];
strcpy(disk, "letsfindcourse");
printf("%s ",disk);
return disk;
}
Answer: A
Here disk is an auto array, when array is used as return value, it will die when the control go back to main() function of a program. Thus memory in c alone prints.