On Fri, 5 Dec 1997, Chuck Reed wrote:
->char abil_desc_parse[] = {
-> "blah blah blah blah\r\n"
-> "blahblahblahblah\r\n"
-> "blah blah blah\r\n",
-> "\0"
->};
->
->Now, a few questions. "\0" == abil_desc_parse[1] right!?
->If this isn't right, Im just going all in the wrong direction (but i thought
->it was.)
Uhm, wrong.
char *abil_desc_parse[] = {
"String0",
"String1",
"String2",
"\0"
};
abil_desc_parse[1] is "String1". abil_desc_parse[3] is "\0" (but you
can't do "if (abil_desc_parse[3] == "\0") {" as that's invalid code
(you can't do string matching with a boolean operator [==, !=, etc.]).
if (*abils_desc_parse[3] == '\0') {
is (should be) valid. Three notes: C starts counting at zero, not
one. Thus, the first character of the first string is [0][0], not
[1][1]. The "\0" is not needed. I don't think any Circle functions
look for it (I thought search_block() looked for '\n'). And, I
believe you have char arrays and char POINTER arrays confused. The
following is a char array:
char array[] = { "Hello.\r\n" }
and indexing that array will give you a single character (array[0] is
'H'). The following is a char pointer array:
char *array[] = { "Hello", "there" };
and indexing it will return a char pointer (to a string constant;
thus, array[0] is "Hello").
daniel koepke / dkoepke@california.com
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST