Ask Question

What is the output from this program? #include void do_something (int * thisp, int that) { int the_other; the_other = 5; that = 2 + the_other; * thisp = the_other * that; } int main (void) { int first, second; first = 1; second = 2; do_something (&second, first); printf ("%4d%4d/n", first, second); return (0); }

+2
Answers (1)
  1. 26 January, 11:09
    0
    1 35

    Explanation:

    * There is a little typo in printf. It should be "/n".

    Initially, the value of the first is 1, and the value of the second is 2. Then, do_something (&second, first) is called. The value of the first will still be 1. However, there is a call by reference for second variable. That means the change made by the function do_something will affect the value of the second variable.

    When you look at the calculation inside the do_something function, you may see that value of the second will be 35.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “What is the output from this program? #include void do_something (int * thisp, int that) { int the_other; the_other = 5; that = 2 + ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers