constint END = -1; //in this example,in order to calculate the length of an Array,we set the last item to -1 manully. intlen(int* array){ int length = 0; for (;array[length]!= END; length++) {} return length+1; } //this func return the length without the last item intlen_effective(int* array){ returnlen(array) - 1; } //create a new array which is one item longer than the previous ,append the num to the effective last int* appendArray(int* array, int num){ int length=len(array); int* newArray = newint[length + 1]; for (int i = 0; i < length - 1; i++) { newArray[i] = array[i]; } newArray[length - 1] = num; newArray[length] = END; return newArray; } //to check whether an array contains a specific item boolisContain(int* array, int item){ int length = len_effective(array); for (int i = 0; i < length; i++) { if (array[i] == item) { returntrue; } } returnfalse; } int all = 7 * 6 * 5 * 4 * 3; int allIncorrect = 0; voidf(int* array){ if (len_effective(array) == 5) { allIncorrect++; return; } for (int next = 1; next <= 7; next++) { if (next == len_effective(array) + 1|| isContain(array, next)) { continue; }