While using this code:
for(int i=0; i<line; i++) {
next_permutation(nums, nums+N);
if(DEBUG) {
for(int j=0; j<N; j++) {
cout << nums[j] << " ";
}
}
}
I am getting this output: -1076591092_1_2_4_3_-1076591092_1_3_2_4_
Int his case, line would be 3, and N is 5;
Thanks!
The problem is related to poor memory management.