J'ai créé un code très simple mais ça ne marche pas! Je veux juste créer un tableau qui contiendra des chaînes. Cependant, ces chaînes doivent être mises sans la méthode des caractères. En d'autres termes:Essayer de mettre une chaîne dans un tableau en c
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
char wstr[20][10];
int i;
for (i=0;i<20;i++)
wstr[i]='BA';
return 0;
}
mais le compilateur me montre un avertissement et une erreur:
[Error] incompatible types when assigning to type 'char[10]' from type 'int'
[Warning] multi-character character constant [-Wmultichar]
Que dois-je faire?
'strcpy (wstr [i]," BA ");' – BLUEPIXY