-=>Quoting Peter Haywood to Alex Walker <=-
PH>Groovy hepcat Alex Walker jived with All on 06 Dec 97 16:33:48!
PH>Finding the end of an array?'s a cool scene. Dig it!
AW>Just wondering, if an array is passed to a function, is there a
AW>way to test for or find the end of the array without having the
AW>size of the array passed to the function?
AW>If it's a char string one could search/test for the null
AW>character, but what if it's an array of integers?
PH>Use a dummy value. That's really all a terminating null is on a
PH>string, after all. The dummy value could be anithing you're sure won't
PH>occur in your data, for example: 0, INT_MAX, INT_MIN, UINT_MAX, etc..
An interger can be any of these values. A better way would be to pass
a array count as the first element of the array. Or, pass it in a
struct.
___ Blue Wave/QWK v2.12
--- Maximus/2 3.01
---------------
* Origin: Madman BBS * Chico, California * 530-893-8079 * (1:119/88)
|