Home > Back-end >  A for loop statement that why there is only one (); ?
A for loop statement that why there is only one (); ?

Time:12-30

# include
Int f (char * sp) {
int k=0;
for(; * sp!='\ 0'; Sp++) {
If (* sp>='a' & amp; & * sp<='z')
k++;
}
The return of k;
}
Int main ()
{
Char sa [81];
Gets (sa);
Printf (" % d ", f (sa));
return 0;
}

CodePudding user response:

There are two, isn't it? How is a?
 for (; * sp!='\ 0'; Sp++) {

Your code, you count a few; A semicolon

CodePudding user response:

Three expressions of the for loop can write 0 to 3, that is, three expressions can be omitted, if omitted, everything is equivalent to the while (true)
  • Related