When is the string literal "hello" allocated and deallocated during the lifetime of the program in this example?
init(char **s)
{
*s = "hello";
}
int f()
{
char *s = 0;
init(&s);
printf("%s
", s);
return 0;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…