|
-
April 28th, 2006, 07:15 PM
#1
another array question
hey guys just wondering if when you put a word in a character array is this still classed as dealing with a character string?
for example
if i had a char array which was char example [100];
and it contained "hello" would hello be classed as a string even though its in a char array?
thanks.
-
April 28th, 2006, 07:52 PM
#2
Re: another array question
string comprised \0.
Kuphryn
-
April 29th, 2006, 11:47 AM
#3
Re: another array question
-
April 29th, 2006, 11:59 AM
#4
Re: another array question
[ Moved thread ]
To 1821. Please post your array or not related questions in the appropriate forum!
Thanks!
-
April 29th, 2006, 12:27 PM
#5
Re: another array question
 Originally Posted by 1821
if i had a char array which was char example [100];
and it contained "hello" would hello be classed as a string even though its in a char array?
In C, the notion of string is not directly supported by the compiler...
A C-style string is only a pointer to a char, such as this char is immediately followed by another char, which itself is followed by another char, up to a '\0' char.
So, we can say that a pointer to the first char of a char[100] array, which contains various characters and a nul terminator, is a string.
But, in reality, where chars of a string are stored doesn't matter for all string-manipulating functions.
"inherit to be reused by code that uses the base class, not to reuse base class code", Sutter and Alexandrescu, C++ Coding Standards.
Club of lovers of the C++ typecasts cute syntax: Only recorded member.
Out of memory happens! Handle it properly!
Say no to g_new()!
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
|