Probleme avec un define d'un char **
Bonjour,
je rencontre un petit probleme de compilation pour mon code dont voici les sources test:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| #include <stdio.h>
#define COUCOU_TAB {"coucou1", "coucou2"}
#define COUCOU {0, COUCOU_TAB}
typedef struct s_test
{
int id;
char **tab;
} t_test;
int main()
{
t_test test[] = COUCOU;
printf("test_coucou : %s\n", test[0].tab[0]);
return (0);
} |
Je me retrouve toujours avec les memes erreurs :
Citation:
test.c:24: warning: missing braces around initializer
test.c:24: warning: (near initialization for 'test[0]')
test.c:24: warning: braces around scalar initializer
test.c:24: warning: (near initialization for 'test[0].tab')
test.c:24: warning: initialization from incompatible pointer type
test.c:24: warning: excess elements in scalar initializer
test.c:24: warning: (near initialization for 'test[0].tab')
Si vous pourviez me donner un petite piste , sa serait cool car je suis decut depuis pas mal de temps.
Merci et bonne journee:mrgreen: