Here is code that works for integer arrays. Please offer guidance on how I can make it work for C-style strings.
andCode://// strCompare.h //// int strCompare(char a[], char b[]);
Thank you.Code://// strCompare.C //// #include "strCompare.h" int strCompare(char a[], char b[]) { if ( a == b ) return0; // a and b are at same location if (a[0]=='\0' && b[0]=='\0') return 0; int ans = a[0]-b[0]; if ( ans == 0 ) return strCompare(a+1, b+1); return ans; }