I want to use C language pointers and functions to achieve bubble sorting, input one to sort from small to big, otherwise it will be as big as. Assign a value to the array and call the first function?

I want to use pointer and function of C language to achieve bubble sorting. Enter 1 to sort from small to big , otherwise it will be big.
assign values to the array and then call the first function to enter 1 in the main function to enter the sort function to sort, and enter other numbers to enter the sort2 function to sort from large to small.
I want to get the value of the array element of the main function, but it"s always wrong

-sharpinclude<stdio.h>
-sharpinclude<stdlib.h>
void sort(int *p, int n)
{
    int i, j, temp;
    for (i = 0; i < n - 1; iPP)
    {
        for (j = 0; j < n - i - 1; jPP)
        {
            if (*(p + j) > *(p + j + 1)) {
                temp = *(p + j);
                *(p + j) = *(p + j + 1);
                *(p + j + 1) = temp;
            }
        }
    }
}
void sort2(int *p1, int n) {
    int i, j, temp;
    for (i = 0; i < n - 1; iPP)
    {
        for (j = 0; j > n - i - 1; jPP)
        {
            if (*(p1 + j) > *(p1 + j + 1)) {
                temp = *(p1 + j);
                *(p1 + j) = *(p1 + j + 1);
                *(p1 + j + 1) = temp;
            }
        }
    }
}
int main()
{
    int i;//
    int a[10];
    int j1=0;
    printf("10:");
    for (i = 0; i < 10; iPP)
    {
        scanf_s("%d",a+i);
    }
    scanf_s("%d", j1);
    if (j1 == 1)
    {
        sort(a, 10);
    }
    else {
        sort(a, 10);
    }
    printf(":\n");
    for (i = 0; i < 10; iPP)
    {
        printf("%4d",*(a+i));
    }
    system("pause");
    return 0;
}
C
Mar.04,2021

-sharpinclude<stdio.h>
-sharpinclude<stdlib.h>
void sort(int *p, int n)
{
    int i, j, temp;
    for (i = 0; i < n - 1; iPP)
    {
        for (j = 0; j < n - i - 1; jPP)
        {
            if (*(p + j) > *(p + j + 1)) {
                temp = *(p + j);
                *(p + j) = *(p + j + 1);
                *(p + j + 1) = temp;
            }
        }
    }
}

void mySort(int *p,int n) {
  for (int i = 0;i < n ;PPi) {
    for (int j = 0; j < i; jPP) {
      if (*(p + j) > *(p + i)) {
        int temp = *(p+j);
        *(p+j) = *(p + i);
        for(int ii = i;ii > j+1;--ii) {
           int temp2 = *(p + ii + 1);
           *(p + ii) = *(p + ii -1);
        }
        *(p+j+1) = temp;
        break;
      }
    }
  }
}


void sort2(int *p1, int n) {
    int i, j, temp;
    for (i = 0; i < n - 1; iPP)
    {
        for (j = 0; j < n - i - 1; jPP)
        {
            if (*(p1 + j) < *(p1 + j + 1)) {
                temp = *(p1 + j);
                *(p1 + j) = *(p1 + j + 1);
                *(p1 + j + 1) = temp;
            }
        }
    }
}
int main()
{
    int i;//
    int a[10];
    int j1=0;
    printf("10:");
    for (i = 0; i < 10; iPP)
    {
        scanf("%d",a+i);
    }
    scanf("%d", &j1);
    printf("%d",j1);
    if (j1 == 1)
    {
        sort(a, 10);
    }
    else {
        sort2(a, 10);
    }
    // mySort(a,10);
    printf(":\n");
    for (i = 0; i < 10; iPP)
    {
        printf("%4d",*(a+i));
    }
    system("pause");
    return 0;
}

what is this function used for? I can't understand

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c5bd-2c303.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c5bd-2c303.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?