Why char a='13'; is invalid in this question? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 22

Why char a='13'; is invalid in this question?

https://www.sololearn.com/post/116129/?ref=app

27th Jun 2019, 8:42 AM
Priyanka♥️
18 Answers
+ 19
You have two characters 1 and 3
27th Jun 2019, 8:44 AM
voja
voja - avatar
+ 21
Piyush Srivastava not bro 😂 say sis😅
27th Jun 2019, 5:46 PM
Priyanka♥️
+ 20
got it voja thank u🙂
27th Jun 2019, 8:52 AM
Priyanka♥️
+ 6
😂😂 but i usually call girls bro 😎that's my way PRIYANKA. No sis 😂😂😇
27th Jun 2019, 6:06 PM
Piyush Srivastava
Piyush Srivastava - avatar
+ 5
Bro actually it represents two characters '1' and '2'.you can use two different char variable for this stuff.
27th Jun 2019, 5:43 PM
Piyush Srivastava
Piyush Srivastava - avatar
+ 5
Nice Questions
28th Jun 2019, 6:48 AM
Pankaj Kumar Maurya
Pankaj Kumar Maurya - avatar
+ 5
anuradha mall please note that char c==''9" is also not valid. Double quotes means String, single quotes is for char (like PRIYANKA mentions)
28th Jun 2019, 1:58 PM
Ad_G
Ad_G - avatar
+ 4
char c==''9" is valid becoz char can hold only one letter but char=="13" is not a char it is string so it is invalid
27th Jun 2019, 7:19 PM
anuradha mall
+ 3
This is bevaise char datatype only accepts one character
28th Jun 2019, 5:48 AM
Anirudh
+ 3
Because character can only contain one digit or alphabet
28th Jun 2019, 5:52 AM
Sanskar Gupta
Sanskar Gupta - avatar
+ 3
Yes and it must be enclosed within single quotes
28th Jun 2019, 6:05 PM
Prince Chauhan
Prince Chauhan - avatar
+ 3
Because char store only 1 bit value and 13 is 2 bit
30th Jun 2019, 8:15 AM
Unique Sharma
Unique Sharma - avatar
+ 2
In 13 there are two characters 1 and 3 so it not suitable for char
28th Jun 2019, 5:53 PM
Prince Chauhan
Prince Chauhan - avatar
+ 2
Char can read only one character
28th Jun 2019, 6:01 PM
satyam reddy
satyam reddy - avatar
+ 2
Char type is only one letter or sign you have two.
29th Jun 2019, 6:49 AM
sandra ojeda
+ 1
You can also use char to store integers, so char a = 13; is valid. Note there is not single quotes around 13.
28th Jun 2019, 4:57 PM
TomT
+ 1
14
29th Jun 2019, 4:02 AM
G S Pravallika
G S Pravallika - avatar
+ 1
You have '13' assigned to a. 13 is two characters. It supposed to be just one character
29th Jun 2019, 5:25 AM
Candice Dick
Candice Dick - avatar