0

Variables

Whenever I declare a variable of data type int in c++. And assign value in such way int a='65'. It gives me some irrelevant output. Why is it so??

27th Oct 2018, 7:11 AM
shahzad
shahzad - avatar
5 Answers
+ 3
just try : int a =65;
27th Oct 2018, 7:18 AM
Vashishtha Upadhyay
Vashishtha Upadhyay - avatar
+ 2
because you can only write one character inside single quote ( ' ) but when you try to write more than one character the compiler will misinterprete that.
27th Oct 2018, 9:04 AM
Tanay
Tanay - avatar
0
I know I miss Semicolon at end. I left it willingly here. I know it is done when I write a=65. but my Question is why it shows irrelevant answer when I place a='65'
27th Oct 2018, 8:41 AM
shahzad
shahzad - avatar
0
Hi
1st Mar 2020, 10:24 PM
Confidence Umeh
Confidence Umeh - avatar
0
It will bring out that irrelevant output because their isn't a space between a and an equal sign
22nd Mar 2021, 6:48 PM
Steven