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]); } } }
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
new TEST_ARRAY[][][eTest] =
new TEST_ARRAY[3][][eTest] =
new TEST_ARRAY[3][3][eTest] =
Thats likely a bug within the compiler because these work fine
pawn Code:
|
for (new i=0; i<sizeof(TEST_ARRAY); i++)
change in for (new i1=0; i1<sizeof(TEST_ARRAY); i1++) And why : You use same name variable in same loop and when you call you second for i change to new i = 0 and loop reset him self . |
new TEST_ARRAY[][][eTest] =
stock const TEST_ARRAY[][][] = {
{
"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-B3"
}, {
"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-B3"
}, {
"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-B3"
}
};
main() {
for(new i, j; i < sizeof TEST_ARRAY; ++i) {
for(j = 0; j < sizeof TEST_ARRAY[]; j += 2) { // + 2 !!!
printf("%s <--> %s", TEST_ARRAY[i][j], TEST_ARRAY[i][j + 1]);
}
}
}