1821
April 28th, 2006, 07:15 PM
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.
kuphryn
April 28th, 2006, 07:52 PM
string comprised \0.
Kuphryn
1821
April 29th, 2006, 11:47 AM
huh?
ovidiucucu
April 29th, 2006, 11:59 AM
[ Moved thread ]
To 1821. Please post your array or not related questions in the appropriate forum!
Thanks!
SuperKoko
April 29th, 2006, 12:27 PM
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.