I tried to store some strings in array. I searched the web and tried out different solutions, but Zorro keeps giving error.

Here is one of my method:
Code
#define MAX_CURRENCIES 5
#define MAX_STRING_LENGTH 50

char* InterestFiles[MAX_CURRENCIES] = {"History\\AUDinterestrate.t6","History\\EURinterestrate.t6", "History\\GBPinterestrate.t6","History\\USDinterestrate.t6","History\\JPYinterestrate.t6"};

function run() {
    BarPeriod = 1440;  // Set bar period to daily
    StartDate = 2021;
    EndDate = 2024;

    // Print interest rate file paths
    for (int i = 0; i < MAX_CURRENCIES; i++) {
        printf("\nInterest Rate File: %s", InterestFiles[i]);
    }
}


Zorro gives this error:
Code
Error in 'line 5: 
syntax error
< char* InterestFiles[MAX_CURRENCIES] = {"History\\AUDinterestrate.t6","History\\EURinterestrate.t6", "History\\GBPinterestrate.t6","History\\USDinterestrate.t6","History\\JPYinterestrate.t6"};
 >.


Here is another method I tried:
Code
#define MAX_CURRENCIES 5           
#define MAX_STRING_LENGTH 50       

char InterestFiles[MAX_CURRENCIES][MAX_STRING_LENGTH];  

void initializeStrings() {
    // Copy file paths into the InterestFiles array
    strcpy(InterestFiles[0], "History\\AUDinterestrate.t6");
    strcpy(InterestFiles[1], "History\\EURinterestrate.t6");
    strcpy(InterestFiles[2], "History\\GBPinterestrate.t6");
    strcpy(InterestFiles[3], "History\\USDinterestrate.t6");
    strcpy(InterestFiles[4], "History\\JPYinterestrate.t6");
}

function run() {
    BarPeriod = 1440;  // Set bar period to daily
    StartDate = 2021;
    EndDate = 2024;

    initializeStrings();

     // Print interest rate file paths
    for (int i = 0; i < MAX_CURRENCIES; i++) {
        printf("\nInterest Rate File: %s", InterestFiles[i]);
    }
}


Zorro gives this error:
Code
Error in 'line 11: 

strcpy(): Pointer expected
<     strcpy(InterestFiles[0], "History\\AUDinterestrate.t6");
 >.

Last edited by vicknick; 10/08/24 14:38.