Hello,
Understood. I am trying to better understand C through learning the indicators source codes and applying them in my scripts. I grabbed a little of tips as I progress.
Regarding the assigning an index to a currency name. I can almost see the loop and the logic, yet it remains slightly unclear.
Code:
#define MAXCURRENCIES 32
var CStren[MAXCURRENCIES],CStrenSum[MAXCURRENCIES];
int CNum[MAXCURRENCIES];
char CNames[MAXCURRENCIES*4];
int NumCurrencies = 0;
// assign an index to a currency name
int ccyIdx(char* name)
{
char Ccy[4];
memcpy(Ccy,name,4);
Ccy[3] = 0;
for(int n=0; n<MAXCURRENCIES; n++) {
if(!CNames[n*4]) { // not yet stored
strcpy(CNames+n*4,Ccy);
NumCurrencies++;
return n;
}
if(strstr(CNames+n*4,Ccy))
return n;
}
return 0;
}
I do not understand the !CNames[n*4] part.
The ! stands for not. I cannot see or understand the logic. How do we know if it is stored or not.
The way I am reading it at first is, if (CNames[0] is not, then copy the string from Ccy to CNames with a 0 etc)
But what is the logic and where is it written.
If the first element in the CName array is not what exactly?
Thank you so much for the help