R
ranveerkunal
where are string literals stored : data segement, stack
ex.
char *test()
{
return("hello");
}
int main()
{
puts(test());
return 0;
}
where is "hello" literal stored (i)stack of test function (ii)data
segement or somewhere else ...
case (i) should print some garbage.
case (ii) should print hello
it prints hello (linux 2.6/gcc if it matters) ..... explain me.
can anyone explain or give some good link, about what gets stored
where.
ex.
char *test()
{
return("hello");
}
int main()
{
puts(test());
return 0;
}
where is "hello" literal stored (i)stack of test function (ii)data
segement or somewhere else ...
case (i) should print some garbage.
case (ii) should print hello
it prints hello (linux 2.6/gcc if it matters) ..... explain me.
can anyone explain or give some good link, about what gets stored
where.