next permutation function can only be used with the vectors?? not with arrays?if not why?
Next permutation function
It can be used with arrays.
I am giving an example code for reference.
int
main()
{
int
arr[] = { 1, 2, 3 };
sort(arr, arr + 3);
cout <<
"The 3! possible permutations with 3 elements:\n"
;
do
{
cout << arr[0] <<
" "
<< arr[1] <<
" "
<< arr[2] <<
"\n"
;
}
while
(next_permutation(arr, arr + 3));
cout <<
"After loop: "
<< arr[0] <<
' '
<< arr[1] <<
' '
<< arr[2] <<
'\n'
;
return
0;
}