Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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;
}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

Students also viewed these Databases questions

Question

If the first quartile of an exponential distribution is 2, find X.

Answered: 1 week ago