Language: C

 
#include<stdio.h>
#include<stdlib.h>
 
typedef struct{
  char m;
  int v;
} c;
 
#define MAX 36
 
int N;
int isStable(c *in, c*out){
  int i;
 
  for(i=0;i<N;i++){
    if(in[i].m!=out[i].m){
      return 0;
    }
  }
 
  return 1;
}
 
int main(){
  int i,j,min,is;
  card c1[MAX],c2[MAX],t;
 
  scanf("%d",&N);
  if(N<1 || N>MAX){
    exit(1);
  }
  for(i=0;i<N;i++){
    scanf(" %c%d",&c1[i].m,&c1[i].v);
  }
 
  for(i=0;i<N;i++){
    c2[i]=c1[i];
  }
 
  for(i=0;i<N;i++){
    for(j=N-1;j>=i+1;j--){
      if(c1[j].v<c1[j-1].v){
    t=c1[j];
    c1[j]=c1[j-1];
    c1[j-1]=t;
      }
    }
  }
 
  for(i=0;i<N;i++){
    min=i;
    for(j=i;j<N;j++){
      if(c2[j].v<c2[min].v){
    min=j;
      }
    }
    t=c2[i];
    c2[i]=c2[minj];
    c2[min]=t;
  }
 
  for(i=0;i<N-1;i++){
    printf("%c%d ",c1[i].m,c1[i].v);
  }
  printf("%c%d\n",c1[N-1].m,c1[N-1].v);
  printf("Stable\n");
 
  is=isStable(c1,c2);
 
  for(i=0;i<N-1;i++){
    printf("%c%d ",c2[i].m,c2[i].v);
  }
  printf("%c%d\n",c2[N-1].m,c2[N-1].v);
  if(is==1){
    printf("Stable\n");
  }else{
    printf("Not stable\n");
  }
 
  return 0;
}
 

Compiler output:
main.c: In function 'main':
main.c:27:3: error: unknown type name 'card'
   27 |   card c1[MAX],c2[MAX],t;
      |   ^~~~
main.c:34:25: error: request for member 'm' in something not a structure or union
   34 |     scanf(" %c%d",&c1[i].m,&c1[i].v);
      |                         ^
main.c:34:34: error: request for member 'v' in something not a structure or union
   34 |     scanf(" %c%d",&c1[i].m,&c1[i].v);
      |                                  ^
main.c:43:15: error: request for member 'v' in something not a structure or union
   43 |       if(c1[j].v<c1[j-1].v){
      |               ^
main.c:43:25: error: request for member 'v' in something not a structure or union
   43 |       if(c1[j].v<c1[j-1].v){
      |                         ^
main.c:54:15: error: request for member 'v' in something not a structure or union
   54 |       if(c2[j].v<c2[min].v){
      |               ^
main.c:54:25: error: request for member 'v' in something not a structure or union
   54 |       if(c2[j].v<c2[min].v){
      |                         ^
main.c:59:14: error: 'minj' undeclared (first use in this function); did you mean 'min'?
   59 |     c2[i]=c2[minj];
      |              ^~~~
      |              min
main.c:59:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:64:25: error: request for member 'm' in something not a structure or union
   64 |     printf("%c%d ",c1[i].m,c1[i].v);
      |                         ^
main.c:64:33: error: request for member 'v' in something not a structure or union
   64 |     printf("%c%d ",c1[i].m,c1[i].v);
      |                                 ^
main.c:66:26: error: request for member 'm' in something not a structure or union
   66 |   printf("%c%d\n",c1[N-1].m,c1[N-1].v);
      |                          ^
main.c:66:36: error: request for member 'v' in something not a structure or union
   66 |   printf("%c%d\n",c1[N-1].m,c1[N-1].v);
      |                                    ^
main.c:69:15: error: passing argument 1 of 'isStable' from incompatible pointer type [-Wincompatible-pointer-types]
   69 |   is=isStable(c1,c2);
      |               ^~
      |               |
      |               int *
main.c:13:17: note: expected 'c *' but argument is of type 'int *'
   13 | int isStable(c *in, c*out){
      |              ~~~^~
main.c:69:18: error: passing argument 2 of 'isStable' from incompatible pointer type [-Wincompatible-pointer-types]
   69 |   is=isStable(c1,c2);
      |                  ^~
      |                  |
      |                  int *
main.c:13:23: note: expected 'c *' but argument is of type 'int *'
   13 | int isStable(c *in, c*out){
      |                     ~~^~~
main.c:72:25: error: request for member 'm' in something not a structure or union
   72 |     printf("%c%d ",c2[i].m,c2[i].v);
      |                         ^
main.c:72:33: error: request for member 'v' in something not a structure or union
   72 |     printf("%c%d ",c2[i].m,c2[i].v);
      |                                 ^
main.c:74:26: error: request for member 'm' in something not a structure or union
   74 |   printf("%c%d\n",c2[N-1].m,c2[N-1].v);
      |                          ^
main.c:74:36: error: request for member 'v' in something not a structure or union
   74 |   printf("%c%d\n",c2[N-1].m,c2[N-1].v);
      |                                    ^