05.04.2013, 15:39
I can't understand why this code doesn't work properly. Can anyone explain me why and how to fix it?
This is the output:
Code:
enum eTest {
pString1[128],
pString2[128]
};
new TEST[3][eTest] =
{
{"This is a test i have named as A1", "This is a test i have named as B1"},
{"This is a test i have named as A2", "This is a test i have named as B2"},
{"This is a test i have named as A3", "This is a test i have named as B2"}
}
new TEST_ARRAY[][3][eTest] =
{
{
{"This is a test i have named as 1-A1", "This is a test i have named as 1-B1"},
{"This is a test i have named as 1-A2", "This is a test i have named as 1-B2"},
{"This is a test i have named as 1-A3", "This is a test i have named as 1-B2"}
},
{
{"This is a test i have named as 2-A1", "This is a test i have named as 2-B1"},
{"This is a test i have named as 2-A2", "This is a test i have named as 2-B2"},
{"This is a test i have named as 2-A3", "This is a test i have named as 2-B2"}
},
{
{"This is a test i have named as 3-A1", "This is a test i have named as 3-B1"},
{"This is a test i have named as 3-A2", "This is a test i have named as 3-B2"},
{"This is a test i have named as 3-A3", "This is a test i have named as 3-B2"}
}
};
main()
{
// This works at expected
for (new i=0; i<sizeof(TEST_ARRAY); i++) {
printf("%s <--> %s", TEST[i][pString1], TEST[i][pString2]);
}
printf("----");
printf("");
printf("----");
// In this prints strings are not completes :S Why?
for (new i=0; i<sizeof(TEST_ARRAY); i++) {
for (new j=0; j<sizeof(TEST_ARRAY[]); j++) {
printf("%s <--> %s", TEST_ARRAY[i][j][pString1], TEST_ARRAY[i][j][pString2]);
}
}
}
Code:
This is a test i have named as A1 <--> This is a test i have named as B1 This is a test i have named as A2 <--> This is a test i have named as B2 This is a test i have named as A3 <--> This is a test i have named as B2 ---- ---- test i have named as 1-A1 <--> test i have named as 1-B1 test i have named as 1-A2 <--> test i have named as 1-B2 test i have named as 1-A3 <--> test i have named as 1-B2 test i have named as 2-A1 <--> test i have named as 2-B1 test i have named as 2-A2 <--> test i have named as 2-B2 test i have named as 2-A3 <--> test i have named as 2-B2 test i have named as 3-A1 <--> test i have named as 3-B1 test i have named as 3-A2 <--> test i have named as 3-B2 test i have named as 3-A3 <--> test i have named as 3-B2


