Language: C

#include <stdio.h>
#define SWAP(type,a,b) {type temp=a; a=b; b=temp;}
int Partition(int *, int, int);
void QuickSort(int *, int, int);

typedef struct{
  int num;
  char mark;
  int check;
}Card;

int main(){
  int i, j, n, flag = 0;

  // Input n
  scanf("%d", &n);

  // Create A[n]
  Card A[n];

  // Input A[n]
  for(i = 0; i < n; i++){
    scanf("%c%d", &A[i].mark, &A[i].num);
    A[i].check = i;
  }

  // QuickSort
  QuickSort(A, 0, n - 1);

  // Judge
  for(i = 0; i < n; i++){
    if(A[i].num == A[i + 1].num && A[i].check > A[i + 1].check){
      printf("Not stable\n");
      flag = 1;
      break;
    }
  }
  if(flag == 0) printf("Stable\n");

  // Output
  for(i = 0; i < n; i++) printf("%c %d\n", A[i].mark, A[i].num);

  return 0;
}

// Partition function
int Partition(Card A[], int p, int r){
  int x, i, j;
  // i is <, j is |

  // Set x, i
  x = A[r];
  i = p - 1;

  // Partition
  for(j = 0; j < r; j++){

    if(A[j] <= x){
      i++;
      SWAP(int, A[i], A[j]);
    }
  }
  SWAP(int, A[i + 1], A[r]);

  return i + 1;
}

// QuickSort function
void QuickSort(Card A[], int p, int r){
  int q;

  if(p < r){
    q = Partition(A, p, r);
    QuickSort(A, p, q - 1);
    QuickSort(A, q + 1, r);
  }
}

Compiler output:
main.c: In function 'main':
main.c:28:13: error: passing argument 1 of 'QuickSort' from incompatible pointer type [-Wincompatible-pointer-types]
   28 |   QuickSort(A, 0, n - 1);
      |             ^
      |             |
      |             Card *
main.c:4:16: note: expected 'int *' but argument is of type 'Card *'
    4 | void QuickSort(int *, int, int);
      |                ^~~~~
main.c: At top level:
main.c:47:5: error: conflicting types for 'Partition'; have 'int(Card *, int,  int)'
   47 | int Partition(Card A[], int p, int r){
      |     ^~~~~~~~~
main.c:3:5: note: previous declaration of 'Partition' with type 'int(int *, int,  int)'
    3 | int Partition(int *, int, int);
      |     ^~~~~~~~~
main.c: In function 'Partition':
main.c:52:7: error: incompatible types when assigning to type 'int' from type 'Card'
   52 |   x = A[r];
      |       ^
main.c:58:13: error: invalid operands to binary <= (have 'Card' and 'int')
   58 |     if(A[j] <= x){
      |        ~~~~ ^~
      |         |
      |         Card
main.c:60:17: error: incompatible types when initializing type 'int' using type 'Card'
   60 |       SWAP(int, A[i], A[j]);
      |                 ^
main.c:2:35: note: in definition of macro 'SWAP'
    2 | #define SWAP(type,a,b) {type temp=a; a=b; b=temp;}
      |                                   ^
main.c:2:45: error: incompatible types when assigning to type 'Card' from type 'int'
    2 | #define SWAP(type,a,b) {type temp=a; a=b; b=temp;}
      |                                             ^~~~
main.c:60:7: note: in expansion of macro 'SWAP'
   60 |       SWAP(int, A[i], A[j]);
      |       ^~~~
main.c:63:13: error: incompatible types when initializing type 'int' using type 'Card'
   63 |   SWAP(int, A[i + 1], A[r]);
      |             ^
main.c:2:35: note: in definition of macro 'SWAP'
    2 | #define SWAP(type,a,b) {type temp=a; a=b; b=temp;}
      |                                   ^
main.c:2:45: error: incompatible types when assigning to type 'Card' from type 'int'
    2 | #define SWAP(type,a,b) {type temp=a; a=b; b=temp;}
      |                                             ^~~~
main.c:63:3: note: in expansion of macro 'SWAP'
   63 |   SWAP(int, A[i + 1], A[r]);
      |   ^~~~
main.c: At top level:
main.c:69:6: error: conflicting types for 'QuickSort'; have 'void(Card *, int,  int)'
   69 | void QuickSort(Card A[], int p, int r){
      |      ^~~~~~~~~
main.c:4:6: note: previous declaration of 'QuickSort' with type 'void(int *, int,  int)'
    4 | void QuickSort(int *, int, int);
      |      ^~~~~~~~~