What is the error in this code

#include<bits/stdc++.h>
using namespace std;

void counting_sort(int a[],int n,int freq_arr[]){
for(int i=0;i<n;i++){
freq_arr[a[i]]++;
}

}

int main() {
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
int maxx=*max_element(a,a+n);
int freq_arr[maxx+1]={0};
counting_sort(a,n,freq_arr);
for(int i=0;i<maxx+1;){
if(freq_arr[i]==0){
i++;
}
else{
for(int j=1;j<=freq_arr[i];j++){
cout<<i<<" ";
}
i++;
}
}

return 0;

}

your code is correct
there may be some error in checker of this problem

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.