YOUR SUBJECT MTH721 Commutative AlgebraChange subject ↗
Introduction to Programming

Question #20

Read the question, compare the options, and review the correct answer below.

CS201 · Midterm#20

Consider the following code segment. What will be the output of following code?
Int addValue (int *a){
int b = (*a) + 2;
return b ;
}
main () {
int x =6 ;
cout << x << “,” ;
cout << addValue(&x) << “,” ;
cout << x ;
}

  1. A
    6,8,6
  2. B
    6,6,8
  3. C
    6,8,8
  4. D
    6,6,6
Show correct answer

Correct answer: A. 6,8,6

Check community answers against your course notes.
← More practice questionsTake a timed test