PW> My input routine requires that the programmer pass (as a parameter) the
PW> maximum length of the string :
PW> after they have declared the variable with a certain length (e.g. like this
PW> :
PW> char String[100] = "";
PW> I tried to automatically determine the maximum string length by using :
PW> int Max_Length = sizeof(String) / sizeof(char);
sizeof(char) is useless - it will ALWAYS be 1.
PW> because it is an array of char. What am I doing wrong?
Apart from that (it does no harm), what is actually wrong? I can't see any
reason why the above code wouldn't set Max_Length to 100. Of course, the
statement above needs to have String[100] in scope, not char *String (which
would return 2/4/etc). BFN. Paul.
@EOT:
---
* Origin: X (3:711/934.9)
|