There is an array of strings (the letters in each word are sorted in descending order, the words themselves are sorted in ascending order). There is an array of indexes.
Why does the test say the test failed? I guess the point is in the declaration of the CheckSortingWords function, namely the argument string [] [10]?
#include <stdio.h> int ComparingStrings(char* firstString, char* secondString) { int i = 0; while (firstString != '\0' && secondString != '\0') { if (firstString[i] > secondString[i]) return 1; else if (firstString[i]<secondString[i]) return -1; i++; } return 0; } int CheckSortingWords(char string[][10], int indexArray[]) { for(int i=0; i<9; i++) if(ComparingStrings(string[indexArray[i]], string[indexArray[i+1]]) == 1) return 0; return 1; } int main() { int i,j; char sortedStrings[10][10] = { "ledba", "ledba", "tmlhea", "tmlhea", "tsrmie", "tsrmie", "tsrmie", "tsrmie", "utoniedca", "utoniedca" }; int indexArray[10] = {0,1,2,3,4,5,6,7,8,9}; printf("\n"); for(int i = 0; i<10; i++) printf("%s\n", sortedStrings[indexArray[i]]); if(CheckSortingWords(sortedStrings, indexArray)) printf("\nTEST PASSED!"); else printf("\nTEST FAILED!"); return 0; }