Language: C++

#include<iostream>
#include<algorithm>
using namespace std;

int bubble(int n, char a[n], int b[n]){
    for(int i = 0; i < n; i++){
        for(int j = n-1; j > 0; j--){
            if(b[j] < b[j-1]){
                swap(b[j], b[j-1]);
                swap(a[j], a[j-1]);
            }
        }
    }
    return 0;
}
int selection(int n, char a[n], int b[n]){
    int minj;
    for(int i = 0; i < n; i++){
        minj = i;
        for(int j = i+1; j < n; j++){
            if(b[minj] > b[j]){
                minj = j;
            }
        }
        if(minj == i){
            continue;
        }
        else{
            swap(b[i], b[minj]);
            swap(a[i], a[minj]);
        }
        
    }
    
    
    return 0;
}
bool isstable(int n, char a[n], char b[n]){
    for(int i = 0; i < n; i++){
        if(a[i] != b[i]){
            return false;
        }
    }
    return true;
}
int main(void){
    int n;
    cin >> n;
    int b[n], b1[n];
    char c[n];
    for(int i = 0; i < n; i++){
        cin >> c[i] >> b[i];
    }
    char c1[n];
    for(int i = 0; i < n; i++){
        c1[i] = c[i];
        b1[i] = b[i];
        
    }
    
    bubble(n, c1, b1);
    selection(n, c, b);
    
    for(int i = 0; i < n; i++){
        if(i == 0){
            cout << c1[i] << b1[i];
        }
        else{
            cout << ' ' << c1[i] << b1[i];
        }
    }
    cout << endl << "Stable" << endl;
    for(int i = 0; i < n; i++){
        if(i == 0){
            cout << c[i] << b[i];
        }
        else{
            cout << ' ' << c[i] << b[i];
        }
    }
    if(isstable(n, c1, c)){
        cout << endl << "Stable" << endl;
    }
    else{
        cout << endl << "Not stable" << endl;
    }
}



Compiler output:
a.cc:5:27: error: use of parameter outside function body before ']' token
    5 | int bubble(int n, char a[n], int b[n]){
      |                           ^
a.cc:5:28: error: expected ')' before ',' token
    5 | int bubble(int n, char a[n], int b[n]){
      |           ~                ^
      |                            )
a.cc:5:30: error: expected unqualified-id before 'int'
    5 | int bubble(int n, char a[n], int b[n]){
      |                              ^~~
a.cc:16:30: error: use of parameter outside function body before ']' token
   16 | int selection(int n, char a[n], int b[n]){
      |                              ^
a.cc:16:31: error: expected ')' before ',' token
   16 | int selection(int n, char a[n], int b[n]){
      |              ~                ^
      |                               )
a.cc:16:33: error: expected unqualified-id before 'int'
   16 | int selection(int n, char a[n], int b[n]){
      |                                 ^~~
a.cc:38:30: error: use of parameter outside function body before ']' token
   38 | bool isstable(int n, char a[n], char b[n]){
      |                              ^
a.cc:38:31: error: expected ')' before ',' token
   38 | bool isstable(int n, char a[n], char b[n]){
      |              ~                ^
      |                               )
a.cc:38:33: error: expected unqualified-id before 'char'
   38 | bool isstable(int n, char a[n], char b[n]){
      |                                 ^~~~