Ask Question
1 October, 04:13

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);

+1
Answers (1)
  1. 1 October, 04:47
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers