Is space considered a character?
My OS is Windows 7 and I am building a wireless LAN chat VS wired LAN chat, and I have been wondering if space is considered a character?开发者_如何学C And if not why? And if yes why?
Yes, space is a character. Usually, programmers use "character" to refer to "some individual and indivisible unit of text." When you're writing out a string or some sequence of text, then you somehow need to mark where in that text the spaces occur. For this reason, character types usually include some encoding of various types of whitespace - spaces, tabs, newlines, etc. The main rationale behind this is that it greatly simplifies the implementation of strings. If your string implementation had to make a distinction between actual text characters and whitespace, it would be much harder to reason about the structure of a string - is it an array? If so, of what? If not, then what is it? Having spaces treated as characters makes the contents of a string uniform and makes it much easier to write programs to manipulate text.
Yes. In programming languages, a character is a value from 0 to 255 that includes letters, spaces and even control characters.
Since it has ASCII Value, it is a character.
精彩评论