"Jim Langston" <tazmaster@[EMAIL PROTECTED]
> writes:
[...]
> Maybe this code will help explain things a little.
>
> #include <iostream>
>
> int main()
> {
> char Data[3][7] = {"Line 1", "Line 2", "Line 3" };
>
> std::cout << Data[0] << "\n";
> std::cout << Data[1] << "\n";
> std::cout << Data[2] << "\n";
>
> std::cout << Data[0][0] << " " << Data[0][1] << "\n";
> }
>
> The output being:
> Line 1
> Line 2
> Line 3
> L i
>
> It is an array of 3 arrays of char. Seeing it in this format should
make
> it fairly clear what is going on.
This thread is cross-posted to comp.lang.c and alt.comp.lang.learn.c-c++.
A C++ example is appropriate in the latter, but not in the former.
Here's the C equivalent:
#include <stdio.h>
int main(void)
{
char Data[3][7] = {"Line 1", "Line 2", "Line 3" };
printf("%s\n", Data[0]);
printf("%s\n", Data[1]);
printf("%s\n", Data[2]);
printf("%c %c\n", Data[0][0], Data[0][1]);
return 0;
}
--
Keith Thompson (The_Other_Keith) <kst-u@[EMAIL PROTECTED]
>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


|