1. ## Constantly adding characters from an array to a string

I have a 2d Array

g[x][y]
Each coordinate is a single character

For each character found I need to put them in a one string

I did something like this :
Code:
for (x = 0; x < LARGEUR; x++)
{
for(y = 0;y < HAUTEUR; y++)
{
if (mystere[x][y] == ESPACE)
{

mottrouve[t] = g[x][y];
t++;
}
}

}
It works but now I need mottrouve in the solution array
solution is declared like that :

typedef char Mot[MAXLONGUEURMOT+1];

solutionnerMotMystere(Grille g, Mot listeDeMotsDansLaGrille[],int nbMotsDansLaGrille, Mot solution, int *err);

I tryed strcpy(solution, mottrouve), doesn't work

I think It's something about the \0 character...

2. Note that people tend to speak English here so a little translation would be nice, especially for such a small piece of code.

Each coordinate is a single character
I assume you mean each element is a char. Or are the coords, x and y, actually chars?

typedef char Mot[MAXWORDLENGTH+1];
It's generally considered somewhat pointless to typedef an array. It's just another thing for someone to remember when reading the code.

I think It's something about the \0 character...
So zero-terminate word.
Code:
for (x = 0; x < width; x++) {
for (y = 0; y < length; y++) {
if (mystery[x][y] == SPACE) {
word[t] = g[x][y];
t++;
}
}
}
word[t] = '\0';

3. Originally Posted by oogabooga
Note that people tend to speak English here so a little translation would be nice, especially for such a small piece of code.

I assume you mean each element is a char. Or are the coords, x and y, actually chars?

It's generally considered somewhat pointless to typedef an array. It's just another thing for someone to remember when reading the code.

So zero-terminate word.
Code:
for (x = 0; x < width; x++) {
for (y = 0; y < length; y++) {
if (mystery[x][y] == SPACE) {
word[t] = g[x][y];
t++;
}
}
}
word[t] = '\0';
Thanks it worked I won't forget that last line for a while :P