mercredi 16 décembre 2020

If wrong condiction c

i have a problem with this code and i don't know why it print B and not A if the conditionis true "strlen(x)" is more bigger than i. Can you help me?

#include <string.h>

int main()
{
   char x[]="Hello";
   int i = -3;
   
   if(strlen(x)>i)
   {
       printf("A");
   }
   else
   {
       printf("B");
   }
    return 0;
}

Aucun commentaire:

Enregistrer un commentaire