Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. (12 points) The following C main program and subprogram are given. Answer the questions based on this program main() { int a,b,c; scanf(%d,a) scanf(%d,b)

image text in transcribed
4. (12 points) The following C main program and subprogram are given. Answer the questions based on this program main() { int a,b,c; scanf("%d",a) scanf("%d",b) printf("%d %d ",a,b); swap(a, b); printf("%d %d ", a,b); } void swap(int px, int py) { int temp; temp =px; px - py; py = temp; } a. What is the main program supposed to do? b. Correct the errors in the scanf statements? c. What is the subprogram supposed to do? d. Suppose a is read as 2 and b is read as 3. What would be the result of the first printf statement? e. What would be the result of the second printf statement? f. If you want the second printf statement to give the intended result, indicate all corrections that should be done

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions

Question

manageremployee relationship deteriorating over time;

Answered: 1 week ago