Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Handbook Of Database Security Applications And Trends

Authors: Michael Gertz, Sushil Jajodia

1st Edition

1441943056, 978-1441943057

More Books

Students also viewed these Databases questions

Question

Prepare a constructive performance appraisal.

Answered: 1 week ago

Question

List the advantages of correct report formatting.

Answered: 1 week ago