Please look at the following code snippets:
char str[]="abcd"; // Gets stored in stack frame.
char *str="abcd"; // Where does this gets stored?
In case of first declaration ie char str[]="abcd"; the string "abcd" gets stored in the stack frame of the invoked funciton. I wonder where does the string gets stored when we declare char *str="abcd"; (Is it in the heap?). Please reply.
Thanks
Iqbal
WolfPack 491 Posting Virtuoso Team Colleague
hollystyles 113 Veteran Poster
hollystyles 113 Veteran Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
hollystyles 113 Veteran Poster
Iqbal_h_a 0 Light Poster
hollystyles 113 Veteran Poster
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.