0
when we use char x ; then input x=97 what is the output??
9 Answers
+ 2
Reminder: "You are wrong" is not a proof.
This should settle the discussion:
http://www.sololearn.com/app/sololearn/playground/cyr7Db1cd4Vi/
#include <iostream>
using namespace std;
int main() {
char x = 97;
cout << x << endl; //prints a
x = '97';
cout << x << endl; //prints 7
char *y = "97";
cout << *y << endl; //prints 9
return 0;
}
0
a
0
OK
when x='97'
why the answer is 7 ?? not 9
0
'97' will give you a compile error...
0
@marcram, you are wrong. please be Sure before give wrong answers and downvote others...
0
@zen,
it is not a proof, but you are right đ...
...and I am right too... đ
- 1
if x=97 the output is "a"
if x='97' it depends on the compiler, probably the output is "7" because it use the last character.
- 1
@bleh990,
NO, '97' doesn't give you a compiler error.
It may give you a warning, but the program works and give "7" as result.
Please, be sure before give wrong answers and downvote other answers...
- 1
@bleh990,
I have just tried to compile, and it works.
Everyone can try, the code is very simple.
And if you google it, you can find answer similar to mine.
So YOU are wrong.