State the values of variables x and ch after the execution of the following statements:
char c = ‘Z’;
int x = c – 1;
char ch = (char) x;
Answers
Answered by
1
Question:-
State the values of variables x and ch after execution of the following statements.
Solution:-
Given code,
char ch='Z';
int x=ch-1;
char ch=(char)x;
ASCII value of Z is 90
So,
x=90-1=89
ch=(char) 89
='Y'
Answer:-
ch='Y' and x=89
Similar questions