What is the symbol for whitespace in C?

后端 未结 7 2095
醉话见心
醉话见心 2020-12-13 08:50

I am trying to figure out how to check if a character is equal to white-space in C. I know that tabs are \'\\t\' and newlines are \'\\n\', but I wa

7条回答
  •  粉色の甜心
    2020-12-13 09:32

    There is no particular symbol for whitespace. It is actually a set of some characters which are:

    ' '      space 
    '\t'     horizontal tab 
    '\n'     newline
    '\v'     vertical tab 
    '\f'     feed 
    '\r'     carriage return    
    

    Use isspace standard library function from ctype.h if you want to check for any of these white-spaces.

    For just a space, use ' '.

提交回复
热议问题