CompuServe Messages

STUDENT RESPONSE ANI3-B

    14-Mar-95 01:06:44
Fm: NAAUG 73204,3522
To: Jack S. Winberg 71513,1522
>>>Jerry>>> We seem to have a conflict. Your telecourse notes stated: "Hint: you will probably have to use the char fname{}="x" format rather than the char fname{x} format to get sizeof() to report back your first and last name lengths correctly". I used the suggested format, but now you seem to have reversed course. Can you help me with the source of my misunderstanding? Thanks. If you use the char fname[x] format, Jack, the sizeof() function becomes the size of the x value, which can be anything. If you use char fname[]="x" format though where x _is_ your name, sizeof() find the length of your name. To rephrase more clearly, the char fname[x] format demands you put the actual size in to begin with whereas the char fname[]="x" format figures out the size if should be. If your name was supercalafrajalisticexpialadocious, it would be pain to have count out the characters using char fname[x] format, but a piece of cake with the char fname[]="supercala…." format. The course notes did state the _any_ string is always the size of itself plus one for the end-of-string designator. <<<Jerry<<<