G
ggnguser
It's part of a test and I'm stumped. There is a function
void foo(char **x)
The function signature is given and cannot be changed, so no passing
of other values. The test case involves defining this variable:
char *y[] = { /* bunch of stuff */ }
and calling
foo(y)
In the above, "bunch of stuff" is a series of triplets, two strings
followed by a null string (""). However, the last triplet ends with an
integer 0. This seems that it's supposed to signify the end of the
array. However, it appears to me that 0 is the same binary value as
for the empty string (NUL, \0, whatever). So in effect, one cannot
test for it as a sentry value because it's actually the same as the
preceding triplets.
How then, can the function foo() determine the bounds of the array?
Knowing the bounds of the particular test case is not sufficient since
the actual test suite may have arrays of varying size.
void foo(char **x)
The function signature is given and cannot be changed, so no passing
of other values. The test case involves defining this variable:
char *y[] = { /* bunch of stuff */ }
and calling
foo(y)
In the above, "bunch of stuff" is a series of triplets, two strings
followed by a null string (""). However, the last triplet ends with an
integer 0. This seems that it's supposed to signify the end of the
array. However, it appears to me that 0 is the same binary value as
for the empty string (NUL, \0, whatever). So in effect, one cannot
test for it as a sentry value because it's actually the same as the
preceding triplets.
How then, can the function foo() determine the bounds of the array?
Knowing the bounds of the particular test case is not sufficient since
the actual test suite may have arrays of varying size.