Given: char newFunc(int & a, int b) { char output = 'Q'; %3D while (a

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 12VE
icon
Related questions
Question
Given:
char newFunc(int & a, int b)
{
char output = 'Q';
%3D
while (a<b)
if (output == 'Q')
output = 'R';
else
output = 'Q';
a += 3;
}
return output;
What is the output of this code if it is called from inside another function with the code below?
char var1;
int var2 = 4, var3 = 6;
var1 = newFunc(var2, var3);
cout << var1 < " " << var2 << ""<< var3 << "\n";
CS Scanned with CamScanner
Transcribed Image Text:Given: char newFunc(int & a, int b) { char output = 'Q'; %3D while (a<b) if (output == 'Q') output = 'R'; else output = 'Q'; a += 3; } return output; What is the output of this code if it is called from inside another function with the code below? char var1; int var2 = 4, var3 = 6; var1 = newFunc(var2, var3); cout << var1 < " " << var2 << ""<< var3 << "\n"; CS Scanned with CamScanner
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning