0
if (strcmp(letra4, "[") == 0) {
char string_sem_colchete[10];
for(i=1; i<strlen(comando4)-1; i++)
{
string_sem_colchete[i-1] = comando4[i];
}
string_sem_colchete[i-1] = '\0';
numero4 = atoi(string_sem_colchete);
printf("%i", numero4);
}
In summary the variable letra4
is the first position of a string
, if the character of that position is "[", it will execute that code within the if
to remove the first and last character of that string
and convert into int
. The code works, the problem is that the IF appears not to be executed.
that, I’ve already tried to do this, but it wasn’t tbm, so I stored the first character of another string in the letter char 4, I print this variable and it appears "[", so I don’t have the slightest idea of why the if not run
– user220443