Home > Back-end >  The small white to ask: how to make the getchar () function returns the next non-white-space charact
The small white to ask: how to make the getchar () function returns the next non-white-space charact

Time:10-24

Int ch;
While (ch=getchar ()) {
If (ch! )
='\ n'For subsequent operations
The else continue;
}

But it can eliminate the influence of a newline? If you want to exclude all white space characters should be how to do? Thank you (bow)
P.S. above are mobile, may what symbol layout is a little confusing, please burke ~

CodePudding user response:

If (ch!='\ n' & amp; & Ch!=' '& amp; & Ch! )='\ t'

CodePudding user response:

 if (ch!='\ n' & amp; & Ch!='\ t' & amp; & Ch!=' ') 

Try this
Or

if (! Isspace (ch))//attention and header files & lt; Ctype. H>

CodePudding user response:

Please refer to "the scanf (), gets () and getline () read input"
Wish I could help you!
  • Related