Home > Mobile >  How to ignore spaces in c programming?
How to ignore spaces in c programming?

Time:11-27

Hi guys i'm kind of new to c programming so sorry if my question seems evident. When i use scanf("%c",c) it counts space as a character so what should i do to ignore the spaces between input characters? Any help would be much appreciated.

CodePudding user response:

The only thing you should do is to consider spaces as characters and scanning them like other characters. for example if you want to scan "a b" in characters, you should write

scanf("%c %c %c", &c1, &c2, &c3);

so that the space will be c2.

  •  Tags:  
  • c
  • Related