Question: 1) The following program compiles and runs without errors. What will get printed? #include void swap1(int a, int b){ int temp = a; a =

1) The following program compiles and runs without errors. What will get printed? #include void swap1(int a, int b){ int temp = a; a = b; b = temp; } void swap2(int a[], int b[]){ int temp = a[0]; a[0] = b[0]; b[0] = temp; } void swap3(int *a, int *b){ int temp = *a; *a = *b; *b = temp; void main(void) { } int a[2] = {2, 6); int b[2] = {0, 4}; swap1(a[0], a[1]); printf("%d, %d\ ", a[0], a[1]); Write your answer here. Solution: //2, 6 //0, 6, 2, 4 //4, 2 swap2(a, b); printf("%d, %d, %d, %d \ ", a[0], a[1], b[0], b[1]); swap3(&b[0], &b[1]); printf("%d, %d\ ", b[0], b[1]); (NO CHANGE) (a - {0, 6), b = {2,4}) (b = {4, 2})

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!