Why this program is showing no error as i am not passing compare function in bubblesort function

include
using namespace std;

bool compare(int a ,int b){
return a>b;
}

void bubblesort(int *arr,int n){
for(int i=0;i<n-1;i++){
for(int j=0;j<n-1-i;j++){
if(compare(arr[j],arr[j+1])){
swap(arr[j],arr[j+1]);
}
}
}
}

int main(){
int n,arr[1000];
cin>>n;
for(int i=0;i<n;i++){
cin>>arr[i];
}
bubblesort(arr,n);
for(int i=0;i<n;i++){
cout<<arr[i];
}
}

hi @adityakakkar
ur code is absolutely correct… what doubt are u having??

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.

hi @adityakakkar
i hope its clear now… there is no error in ur code… if there is still anything do let me know, or shall I mark the doubt as resolved???