Language: C++

#include<iostream>
#include<algorithm>
#include<string>
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];
        cout << c[i] << ' ' << b[i]<< endl;
    }
    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:6:27: error: use of parameter outside function body before ']' token
    6 | int bubble(int n, char a[n], int b[n]){
      |                           ^
a.cc:6:28: error: expected ')' before ',' token
    6 | int bubble(int n, char a[n], int b[n]){
      |           ~                ^
      |                            )
a.cc:6:30: error: expected unqualified-id before 'int'
    6 | int bubble(int n, char a[n], int b[n]){
      |                              ^~~
a.cc:17:30: error: use of parameter outside function body before ']' token
   17 | int selection(int n, char a[n], int b[n]){
      |                              ^
a.cc:17:31: error: expected ')' before ',' token
   17 | int selection(int n, char a[n], int b[n]){
      |              ~                ^
      |                               )
a.cc:17:33: error: expected unqualified-id before 'int'
   17 | int selection(int n, char a[n], int b[n]){
      |                                 ^~~
a.cc:39:30: error: use of parameter outside function body before ']' token
   39 | bool isstable(int n, char a[n], char b[n]){
      |                              ^
a.cc:39:31: error: expected ')' before ',' token
   39 | bool isstable(int n, char a[n], char b[n]){
      |              ~                ^
      |                               )
a.cc:39:33: error: expected unqualified-id before 'char'
   39 | bool isstable(int n, char a[n], char b[n]){
      |                                 ^~~~