Language: C

#include <stdio.h>

struct Card {char suit; int value;};

void printStructArray(struct Card var[], int num) {
  int i;
  for (i = 0; i < num; i++) {
      if (i > 0) printf(" ");
      printf("%c%d", var[i].suit, var[i].value);
  }
  printf("\n");
}

void bubbleSort(struct Card var[], int num) {
  int i, j;
  Card tmp;

  for (i = 0; i < num; i++) {
    for (j = num -1; j > i; j--) {
        if (var[j].value < var[j - 1].value) {
            tmp = var[j];
            var[j] = var[j - 1];
            var[j - 1] = tmp;
        }
    }
  }
}

void selectionSort(struct Card var[], int num) {
  int i, j, iMin;
  Card tmp;
  for (i = 0; i < num; i++) {
    iMin = i;
    for (j = i; j < num; j++) {
      if (var[iMin].value > var[j].value) {
        iMin = j;
      }
    }
    tmp = var[i];
    var[i] = var[iMin];
    var[iMin] = tmp;
  }
}

int main(void) {
  int i, num;
  scanf("%d", &num);
  Card varBubble[num];
  Card varSelection[num];
  getchar();
  for (i = 0; i < num; i++) {
    scanf("%c%d", &varBubble[i].suit, &varBubble[i].value);
    varSelection[i] = varBubble[i];
    getchar();
  }
  
  bubbleSort(varBubble, num);
  printStructArray(varBubble, num);
  printf("Stable\n");
  
  selectionSort(varSelection, num);
  printStructArray(varSelection, num);
  printf("Not stable\n");
  
  return 0;
}


Compiler output:
main.c: In function 'bubbleSort':
main.c:16:3: error: unknown type name 'Card'; use 'struct' keyword to refer to the type
   16 |   Card tmp;
      |   ^~~~
      |   struct 
main.c:21:19: error: incompatible types when assigning to type 'int' from type 'struct Card'
   21 |             tmp = var[j];
      |                   ^~~
main.c:23:26: error: incompatible types when assigning to type 'struct Card' from type 'int'
   23 |             var[j - 1] = tmp;
      |                          ^~~
main.c: In function 'selectionSort':
main.c:31:3: error: unknown type name 'Card'; use 'struct' keyword to refer to the type
   31 |   Card tmp;
      |   ^~~~
      |   struct 
main.c:39:11: error: incompatible types when assigning to type 'int' from type 'struct Card'
   39 |     tmp = var[i];
      |           ^~~
main.c:41:17: error: incompatible types when assigning to type 'struct Card' from type 'int'
   41 |     var[iMin] = tmp;
      |                 ^~~
main.c: In function 'main':
main.c:48:3: error: unknown type name 'Card'; use 'struct' keyword to refer to the type
   48 |   Card varBubble[num];
      |   ^~~~
      |   struct 
main.c:49:3: error: unknown type name 'Card'; use 'struct' keyword to refer to the type
   49 |   Card varSelection[num];
      |   ^~~~
      |   struct 
main.c:52:32: error: request for member 'suit' in something not a structure or union
   52 |     scanf("%c%d", &varBubble[i].suit, &varBubble[i].value);
      |                                ^
main.c:52:52: error: request for member 'value' in something not a structure or union
   52 |     scanf("%c%d", &varBubble[i].suit, &varBubble[i].value);
      |                                                    ^
main.c:57:14: error: passing argument 1 of 'bubbleSort' from incompatible pointer type [-Wincompatible-pointer-types]
   57 |   bubbleSort(varBubble, num);
      |              ^~~~~~~~~
      |              |
      |              int *
main.c:14:29: note: expected 'struct Card *' but argument is of type 'int *'
   14 | void bubbleSort(struct Card var[], int num) {
      |                 ~~~~~~~~~~~~^~~~~
main.c:58:20: error: passing argument 1 of 'printStructArray' from incompatible pointer type [-Wincompatible-pointer-types]
   58 |   printStructArray(varBubble, num);
      |                    ^~~~~~~~~
      |                    |
      |                    int *
main.c:5:35: note: expected 'struct Card *' but argument is of type 'int *'
    5 | void printStructArray(struct Card var[], int num) {
      |                       ~~~~~~~~~~~~^~~~~
main.c:61:17: error: passing argument 1 of 'selectionSort' from incompatible pointer type [-Wincompatible-pointer-types]
   61 |   selectionSort(varSelection, num);
      |                 ^~~~~~~~~~~~
      |                 |
      |                 int *
main.c:29:32: note: expected 'struct Card *' but argument is of type 'int *'
   29 | void selectionSort(struct Card var[], int num) {
      |                    ~~~~~~~~~~~~^~~~~
main.c:62:20: error: passing argument 1 of 'printStructArray' from incompatible pointer type [-Wincompatible-pointer-types]
   62 |   printStructArray(varSelection, num);
      |                    ^~~~~~~~~~~~
      |                    |
      |                    int *
main.c:5:35: note: expected 'struct Card *' but argument is of type 'int *'
    5 | void printStructArray(struct Card var[], int num) {
      |                       ~~~~~~~~~~~~^~~~~