C programming homework help - pointers - can somebody write this function?

Kenny B

New member
I am just getting over strept throat and have fell very far behind in my C programming class and have homework due in the morning.

We are working with pointers and I have to write a function to sort three integers into ascending order ( not to be implemented with arrays)

the function has to be callable from this main function below:

#include <stdio.h>
void sort3(int* vals);
int main(){
int vals[] = {25,-5,4};
printf("Before sort: %d %d %d \n",vals[0],vals[1],vals[2]);
sort3(vals);
printf("After sort: %d %d %d \n",vals[0],vals[1],vals[2]);
}


immediate 5 stars and best answer if anyone knows how to write this function
 
Back
Top