Double char array

Status
Not open for further replies.

Manu

Well-known member
Hello,

It's look like we can't do this with arduino/teensy ?

Code:
char Nom[10][20]={"Paris","Marseille","Lyon","Rennes","Toulouse","Strasbourg","Grenoble","Lille","Nantes","Bordeaux"};

Or do I miss something ?

Thank you,
Manu
 
In fact it work, but compiler complain ;-)

Is there another way to do this ?

the goal is to call a string in regard with a number.
 
Code:
char *Nom[10]={"Paris","Marseille","Lyon","Rennes","Toulouse","Strasbourg","Grenoble","Lille","Nantes","Bordeaux"};

or
Code:
char *Nom[]={"Paris","Marseille","Lyon","Rennes","Toulouse","Strasbourg","Grenoble","Lille","Nantes","Bordeaux"};

Pete
 
In fact it work, but compiler complain ;-)

Is there another way to do this ?

the goal is to call a string in regard with a number.

Manu:

What specific complaint do you get from the compiler ?? Can you attach the source for your sketch ?? These details may make it easier to assist.

Mark J Culross
KD5RXT
 
Hi,

I'm sorry, it was a code error. I placed this definition in a "switch/case" case and it complain (and break the switch/case choices).
I then moved the definition in a function that is called by the "case" and all is now OK.

I'm sorry for the trouble,
Manu
 
ISO C++ is way picky about string constant to char * conversion. Just a warning in GCC -fpermissive.
 
Status
Not open for further replies.
Back
Top