Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program using C language More Pointers and Functions Write a function, r

ID: 654150 • Letter: W

Question

Write a program using C language

More Pointers and Functions

Write a function, reorder(), which is given three pointers to floats and reorders the values pointed to into ascending order. The prototype for this function is:

i.e. when your function is done, the following should hold:

Use your swap_big() function from the previous problem to implement reorder(). Your data file, reorder.dat, should show that your function works under all conditions. Write a driver to allow you to test this function for different triplets of floats when redirected from your data file.

Explanation / Answer

/* C Program to swap two numbers using pointers and function. */ #include void swap(int *a,int *b); int main(){ int num1=5,num2=10; swap(&num1,&num2); /* address of num1 and num2 is passed to swap function */ printf("Number1 = %d ",num1); printf("Number2 = %d",num2); return 0; } void swap(int *a,int *b){ /* pointer a and b points to address of num1 and num2 respectively */ int temp; temp=*a; *a=*b; *b=temp; }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote