| Author |
switch case
|
Shiva Mohan
Ranch Hand
Joined: Jan 05, 2006
Posts: 465
|
|
Why case �25� is showing error but case �1� and case �4� are not showing error since all are inside the char range? Help please
|
 |
Keith Lynn
Ranch Hand
Joined: Feb 07, 2005
Posts: 2341
|
|
|
A character constant can only contain one character.
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
To expand on what Keith said... Assigned to a char variable, an int literal (without quotes) represents a char value. For example, a decimal value of 51 represents the char '3'. char three = 51; But an int inside single quotes is interpreted as a char. char three = '3'; Similarly, '5' is a char, and '1' is a char. But '51' is not a char. (And of course, an int inside double quotes is interpreted as a String.)
|
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
|
 |
kwan Jang
Greenhorn
Joined: Sep 24, 2006
Posts: 16
|
|
|
just one character,such char a = 'b'; char n='2'
|
 |
 |
|
|
subject: switch case
|
|
|