#include <stdio.h>
#include <stdlib.h>
char *color[] =
{
/*0*/"red||bluegreen",
/*1*/"blue",
/*2*/"green",
"\0"
};
int fun1(char * str1)
{
int c = 0;
while(1)
{
if(str1[c] == '|' && str1[c+1] == '|')
return c;
c++;
}
return 0;
}
1. int main()
2. {
3. int ret=0, offset=0;
4. ret = fun1(color[offset]);
5 offset += ret;
6 ret = fun1(color[offset]);
7 return 0;
}
Dans l'extrait de code ci-dessus dans main()
à la ligne 6 de l'argument fun1()
est color[offset] = NULL
Pourquoi color[offset] = NULL
après l'opération offset += ret
. S'il vous plaît précisertampon devient nulle après réindexation
Merci