Question: #include /* * WARNING: This version of the program contains at least one bug! */ int level; enum { N_ELEM = 3, NOT_DONE = -1
#include
/* * WARNING: This version of the program contains at least one bug! */ int level; enum { N_ELEM = 3, NOT_DONE = -1 }; int val[N_ELEM]; void recur(int k) { int i; val[k] = level; level++; if (level == N_ELEM) { for (i = 0; i
The code above contains one bug. It is supposed to generate all 6(=3!) possible numerical permutations of integers form 0 - 2 inclusive, one per line. I need help finding and fixing the bug please.
initialization -1-1-1 level o 0-1 -1 -1 0 -1 -1 -1 0 0 1 -1 1 O -1 1 -1 0 level 1 0-1 1 -1 0 1 -1 1 1 0 level 2 0 1 2 1 0 2 1 2 0 0 0 2 1 2 0 1 210
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts

#include