|
-
Jul 3rd, 2002, 07:51 AM
#1
Character arrays and pointers
I have a few questions here...
char *something
char otherthing[50];
something allocates a pointer to a character. I've seen strings/character arrays passed around using these. How much storage does this really offer? Is it safe? I can actually point to a string that I haven't allocated storage for with this?
otherthing allocates a character array, I'm comfortable with the storage here. However, I can't return a function to a character array. I seem to have to use a character pointer (*something).
One final question in regards to character pointers:
char *SomeFun(){
char *something
return something
}
If I call this function several times to return a character pointer will my storage be ok? I'm not eating memory, right?
(I know..basic ?'s. Thanx for your patience (and answers..<G>))
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|