| | |
Where does the string gets stored?
![]() |
•
•
Join Date: Aug 2006
Posts: 29
Reputation:
Solved Threads: 1
C Syntax (Toggle Plain Text)
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
Last edited by Iqbal_h_a; Sep 7th, 2006 at 7:12 am.
•
•
•
•
(Is it in the heap?)
Wolfie ?
p.s.
Yeah and put [ CODE ] [/ CODE ] around JUST the code not the whole post, like Wolpack said please.
Last edited by hollystyles; Sep 7th, 2006 at 7:22 am.
Wolfpack just gave me this URL
http://www.daniweb.com/techtalkforums/thread50780.html
Moral:
Search the forums before posting.
http://www.daniweb.com/techtalkforums/thread50780.html
Moral:
Search the forums before posting.
Last edited by hollystyles; Sep 7th, 2006 at 7:34 am.
>>char *str="abcd";
There are two objects here -- the pointer itself is a variable that is on the stack. It contains the address of the string that is stored in the heap -- often in read-only memory.
[edit]Sorry Holly I didn't see your last post when I posted this. The link you posted is a much better and thorough explaination.[/edit]
There are two objects here -- the pointer itself is a variable that is on the stack. It contains the address of the string that is stored in the heap -- often in read-only memory.
[edit]Sorry Holly I didn't see your last post when I posted this. The link you posted is a much better and thorough explaination.[/edit]
Last edited by Ancient Dragon; Sep 7th, 2006 at 7:38 am.
•
•
•
•
[edit]Sorry Holly I didn't see your last post when I posted this. The link you posted is a much better and thorough explaination.[/edit]
"Big red and firey, always late"
:lol:
Last edited by hollystyles; Sep 7th, 2006 at 9:10 am.
•
•
Join Date: Aug 2006
Posts: 29
Reputation:
Solved Threads: 1
•
•
•
•
Please post your question outside code tags. I corrected your first two posts, do this one yourself, or I will delete this thread. Since it has been only 2 minutes since your post, you can edit it now.
I tried to edit the post as you suggested, but could not do so.
I will definitely take care of all the rules in my future posts.
I am extremely sorry if I hurt anybody by breaking the rules.
Thanks
Iqbal
•
•
•
•
Sorry for my ignorance. As I am new to this blog, I was unaware of the rules.
I tried to edit the post as you suggested, but could not do so.
I will definitely take care of all the rules in my future posts.
I am extremely sorry if I hurt anybody by breaking the rules.
Thanks
Iqbal
he he anyway at least we know you got the message now.
Of course we don't expect you to know all the rules straight off. If you look in my signature there's a link to 'the basics', I recommend reading that it will help you to make good posts that will get read and answered. Forums are a bit like Ebay you gotta put some effort into the listing to get bids and a sale, same here to get good answers.
Lastly don't mind WolfPack he's a big softy really, but he has the onerous responsibility of being a moderator and keeping everyone in line and the threads looking neat and tidy, so he has to throw his weight around a litte otherwise everyone would just ignore him, and the forum would be an unsightly mess. The knowledgeable people with all the answers only come and stay and answer posts in nice neat forums so the effort is worth it I think.
Last edited by hollystyles; Sep 8th, 2006 at 3:59 am. Reason: typos
•
•
•
•
Sorry for my ignorance. As I am new to this blog, I was unaware of the rules.
I tried to edit the post as you suggested, but could not do so.
I will definitely take care of all the rules in my future posts.
I am extremely sorry if I hurt anybody by breaking the rules.
Thanks
Iqbal
Keep rocking....
I don't accept change; I don't deserve to live.
Sacrifice is a painful, pure and beautiful thing.
Dammit, Jones, What the Hell Are Knoll Pointers?!
Sacrifice is a painful, pure and beautiful thing.
Dammit, Jones, What the Hell Are Knoll Pointers?!
![]() |
Similar Threads
- Open In New Window Php (PHP)
- Permutation (C++)
- One Dimensional Array (C++)
- how to get files and store them... (C++)
- Need Urgent Help with 2 Projects (Shell Scripting)
- using OCI to call a ORACLE stored function (C++)
- Comparing String with a 2D Array (C++)
Other Threads in the C Forum
- Previous Thread: how to make utilize of system( ) function
- Next Thread: glut
Views: 1481 | Replies: 8
| Thread Tools | Search this Thread |
Tag cloud for C
#include api array arrays binary binarysearch bit build c++ c/c++ calling char character code coke command conversion convert database decimal directory dude dynamic error exec executable factorial fflush fgets file floatingpointvalidation fork function functions getline givemetehcodez grade graphics haiku help|help|help|help homework i/o include input insert int integer intmain() keyboard lazy line linked linkedlist linux list lists loop malloc matrix memory mysql no-effort output overwrite parallel path permutations pointer pointers problem process program programming read readfile recursion recursive recv reverse scanf segmentationfault socketprograming sockets spoonfeeding stdin string strings strtok structures student system testing turbo-c turboc unix user variable win32 windows _getdelim






