I have an array of strings which when I iterate through and print its elements gives me unexpected results.
char currencies[][3] = {"EUR", "GBP", "USD", "JPY", "CNY"};
void show_currencies()
{
int i;
for(i=0; i<5; i++)
{
printf("%s - ", currencies[i]);
}
}
when I call show_currencies()
I get this on output.
EURGBPUSDJPYCNY - GBPUSDJPYCNY - USDJPYCNY - JPYCNY - CNY -
Can anyone explain this behaviour.
Thank you