COMPILER ERROR: "Sort" was not declared in this scope

sir i am not unable to use inbuilt sort() it’s showing not declared in this scope …

After adding #include
it’s showing

*** stack smashing detected ***: terminated

i guess stack overflow …

hi @panditabhi29263 add #include <bits/stdc++.h> it will add all headers

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

int main(){
int a[]={3,6,32,1,2};
int n = sizeof(a);
sort(a,a+n);
for(int i=1;i<n;i++){
cout<<a[i]<<endl;

}
cout<<endl;
return 0;

}

output :

-920664064
-12690632
0
0
1
1
2
3
6
32
21973
32662
32662
32767
32767
72704
1421951107
1423821696
1772804999

*** stack smashing detected ***: terminated

hi @panditabhi29263
go to ide.codingblocks.com
login
write
save
send the url of the page

problem solved …

size = sizeof(arr)/sizeof(int)

oh nice buddy @panditabhi29263

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.