Ask Question
9 December, 22:51

Consider the following function definition. void strange (int& u, char& ch) { int a; a = u++; u = 2 * u; a = static_cast (ch); a++; ch = static_cast (a); } What are the values of one and letter after the following statements execute? int one = 5; char letter = 'A'; strange (one, letter);

+5
Answers (1)
  1. 9 December, 23:29
    0
    The output to this question is "one = 12; letter = 'B' ".

    Explanation:

    In the given code we define a method that is "strange" in this method we pass two variable that is "u and ch" where u is an integer variable and ch is character variable. Inside a method, we declare an integer variable that is "a" we use this variable 2 times.

    The first time we use variable a that increases the value of variable u by 1 and multiply by 2. and print its value. second time we use this variable (a) This time we use this for hold char variable value and increase the variable value by using type casting and print its value.

    In calling time we pass value "5 and A " it will return "12 and B".
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Consider the following function definition. void strange (int& u, char& ch) { int a; a = u++; u = 2 * u; a = static_cast (ch); a++; ch = ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers