Getting error on my compiler

#include
using namespace std;

void bubble_sort(int a[], int n){
if (n==1){
return;
}

for (int j = 0; j < n-1; j++){
    if (a[j] > a[j+1]){
        swap(a[j], a[j+1]);
    }
}
bubble_sort(a, n-1);

}

void bubble_sort_completely_recurrsively(int a[], int j, int n){
if (n==1){
return;
}

if (j==n - 1){
    return bubble_sort_completely_recurrsively(a, 0, n-1);
}

if (a[j] > a[j+1]){
    swap(a[j], a[j+1]);
}
bubble_sort_completely_recurrsively(a, j+1, n);
return;

}

int main(){
int n;
int a[n];

for (int i = 0; i < n; i++){
    cin >> a[i];
}

for (int i = 0; i < n; i++){
    cout << a[i] << " " << endl;
}

cout << bubble_sort(a, n) << endl;
cout << bubble_sort_completely_recurrsively(a, 0, n);

return 0;

}

hello @udatta

pls save ur code on cb ide and share its link with me

Where can I find the ide?

check now

It is showing no output

give some input in input box before running

I have given input 5 53412

Now its working thank you

In void function after calling it we need to print it manually because it returns nothing. Right?

yes…



I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.