Lisaveta777

Output first non-space symbol

Aug 23rd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctype.h>
  3.  
  4. //print first not-space symbol
  5.  
  6. char get_first(void);
  7. int main(void)
  8. {
  9.     char ch = get_first();
  10.     printf("First symbol is %c\n",ch);
  11.  
  12.     return 0;
  13. }
  14. char get_first()
  15. {
  16.     char c;
  17.     while((c=getchar())!=EOF)
  18.     {
  19.         if (!isspace(c))
  20.             break;
  21.  
  22.     }
  23.     return c;
  24. }
Add Comment
Please, Sign In to add comment