??? 02/23/08 18:23 Read: times |
#151340 - For but one byte added to the array... Responding to: ???'s previous message |
You should consider going back and getting rid if the MAX_LINES macro definition. Use the suggestions that were given such that the last element of the string array is one of "". Then change the end of array check to one of checking for this string as a NULL string. Anytime you can reduce maintenance steps for later support of a program the better it is. The way you have it now you have to remember each time to count how many entries are in the array and go back and change the value of the MAX_LINES definition. Five years from now when somebody has to add strings they (or you) will miss this latter step and end up spending some time debugging and having to re-compile several times.
Since this array is actually an array of "char *" pointers it is also possible to use another method of auto-sizing without the ending "" string constant. C language has the handy operator that would let you write the "for" loop as follows. You may need to look at how you have the array declared and review the suggestion that Tsuneo made in his first post here. for(line_no = 0; line_no < (sizeof(phrases)/sizeof(char *)); line_no++ ) Michael Karas |