take this function
in case of passing empty strings i make s = s -1; i won't be using the values or writing to these locations.Code:/* this checks if t is at the end of s*/ int mystrend(char* s,char* t){ int l1 = strlen(s); int l2 = strlen(t); if(l2 > l1) return 0; s = s + l1 - 1; t = t + l2 - 1; while(l2--){ if(*s-- != *t--) return 0; } return 1; }
i heard that it is fine to refer to these (one less and one more) , am i correct ? Please explain.