When I compare getchar() != '/n' I get the warning: multi-character character constant. I wounder why? I code in C and use gcc as compiler. I thought that getchar read in one character and converted it to int for itself. So what's the meaning of multi-character character constant?
Asked
Active
Viewed 1,280 times
-2
-
Possible duplicate of [Multiple characters in a character constant](https://stackoverflow.com/questions/6944730/multiple-characters-in-a-character-constant) – phuclv Aug 07 '17 at 17:20
2 Answers
6
'/n' is 2 characters I think you are looking for '\n'
Getchar() will get 1 char '/n' is 2 characters (and because you defined the characters already it is a constant) so it is a multiple character character constant

J. van Dijk
- 395
- 3
- 6
0
'/n' is two characters / and n. Hence multi character. getchar reads one character at a time. i think you want to use line break which is '\n'.

Abhishek
- 79
- 1
- 7