Question: Type the program's output / / New means new compared to previous level #include #include #include const int TOTAL _ NUMS = 3 ; void

Type the program's output
// "New" means new compared to previous level
#include
#include
#include
const int TOTAL_NUMS =3;
void ScrambleNums(int* remainNums, int* scramNums, bool* numAdded, int numCnt){
int i;
if (numCnt == TOTAL_NUMS){
for (i =0; i numCnt; ++i){
printf("%d", scramNums[i]);
}
printf("
");
}
else {
for (i = TOTAL_NUMS -1; i >=0; --i){// New: This line changed
if (!numAdded[i]){
numAdded[i]= true;
scramNums[numCnt]= remainNums[i];
ScrambleNums(remainNums, scramNums, numAdded, numCnt +1);
numAdded[i]= false;
}
}
}
}
int main(void){
int* numsToScramble = NULL;
int* resultNums = NULL;
bool* numAdded = NULL;
numsToScramble =(int*)malloc(sizeof(int)* TOTAL_NUMS);
resultNums =(int*)malloc(sizeof(int)* TOTAL_NUMS);
numAdded =(bool*)malloc(sizeof(int)* TOTAL_NUMS);
numAdded[0]= false;
numAdded[1]= false;
numAdded[2]= false;
numsToScramble[0]=3;
numsToScramble[1]=0;
numsToScramble[2]=6;
ScrambleNums(numsToScramble, resultNums, numAdded, 0);
return 0;
}
 Type the program's output // "New" means new compared to previous

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!