Home > Back-end >  C write a piece of code below, run results error, can you tell me where the problem is?
C write a piece of code below, run results error, can you tell me where the problem is?

Time:09-21

#include
Int main ()
{
Char x [999];
Int I, a=0, b=0, c=0, d=0;
Gets (x);
for(i=0; i<=x [I]; I++)
{
If (' A '& lt; [I]=x & amp; & X [I] <='z')
+;
Else if (' 0 '& lt; [I]=x & amp; & X [I] <='9')
B++;
Else if (x [I]==' ')
C + +;
The else
D++;
}
Printf (" % d % d % d % d \ n ", a, b, c, d);
return 0;
}

CodePudding user response:

Length of the string to use strlen (x);
Your usage is not correct
  • Related