Salut. J'ai cette erreur quand je tente de mettre ma variable p dans un tableau :
/home/mamatheking/Programation/DB9command/main.c|40|error: incompatible types when assigning to type char[5000] from type char *
c'est dans ce code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
int main()
{
//déclaration des variables principales
char command[MAX_TAB];
char prefix_var;
char *prefix = &prefix_var;
int exitvar = 0;
char arguments [100][5000];
char *pointeur_arguments = &arguments;
int cpt = 0;
printf("Welcome in the prompt!\n");
do
{
printf("prompt# ");
scanf("%s",command);
char * pointeur_command = command;
char pvar[5000];
char * p = NULL;
cpt = 0;
while ((p = strtok (pointeur_command, " ")) != NULL)
{
arguments[cpt]=p; // c'est exactement ici que se lève l'erreur
pointeur_command = NULL;
cpt ++;
printf("p= %s",p);
}
[...]
} while (exitvar == 0);
return 0;
} |
Je ne sais pas trop comment résoudre ça
Avez vous une idée ?
Merci d'avance.
(J'utilise code blocks, GCC 4.5.2, ubuntu 11.4 avec noyau 2.6.38-11-generic-pae)
Partager