A
arnuld
Stroustrup says:
"Arrays are not self describing because the number of elements of an
Array is not guarnteed to be stored with Array"
"this implies that o traverse an Array that does not contain a
terminator the way character string do, we must somehow supply the
number of elements"
i don't understand the relation of these 2 statements because if an
Array does not contain a '\0' terminator in the end, it is not an
Array, it is just a data-structure that looks-like an Array but it is
not an Array. Arrays always end in '\0'.
right ?
void fp(char v[], unsigned int size)
{
for(i=0; i<size; i++)
use (v);
const int N=7;
char v2[];
for((int i=0; i<N; i++)
use (v2);
}
so v[] and v2[] are not arrays because they do not contain '\0' in the
end.
"Arrays are not self describing because the number of elements of an
Array is not guarnteed to be stored with Array"
"this implies that o traverse an Array that does not contain a
terminator the way character string do, we must somehow supply the
number of elements"
i don't understand the relation of these 2 statements because if an
Array does not contain a '\0' terminator in the end, it is not an
Array, it is just a data-structure that looks-like an Array but it is
not an Array. Arrays always end in '\0'.
right ?
void fp(char v[], unsigned int size)
{
for(i=0; i<size; i++)
use (v);
const int N=7;
char v2[];
for((int i=0; i<N; i++)
use (v2);
}
so v[] and v2[] are not arrays because they do not contain '\0' in the
end.