I need some help with pointers. We are starting to learn pointers in class, and just got an assignment. The assignment is to make code so that a user inputs integers into an array, and at the end, it will sort them through "selection sort".

I get the idea, and have the idea, but I can not seem to grasp how to translate the selection sort part of the code into using pointers. Right now it is in the form of arrays...

If you could help that would be great. Also I may need help with the swap part, which is used in the selection sort to swap the numbers....

Thanks

Code:#include<stdio.h> #define N 20 void sort(const int *p, int len); void swap(const int *p, int a, int b); void sort(const int *p, int len) { int x, y, index_of_min, temp; for(x=0; x<len; x++) { index_of_min = x; for(y=x; y<len; y++) { if(array[index_of_min] < array[y]) index_of_min = y; } temp = array[x]; array[x] = array[index_of_min]; array[index_of_min] = temp; } } void swap(const int *p, int a, int b) { } int main(void) { int i, length; int array[N] = {0}; printf("\nInput the length of array: "); scanf("%d", &length); printf("Input the elements of array\n"); for(i=0; i< length; i++) { printf("\nElement %d: ", i); scanf("%d", &array[i]); } printf("\nThe input elements of the array are:\n"); for(i=0; i< length; i++) { printf("%d", array[i]); printf(", "); } sort(array, length); return(0); }