Corrected code:
int strrindex(char *s, char *t) {
int i, j, k, p;
i = -1;
for (k = 0; s[k] != '\0'; k++) {
if (strlen(s) < strlen(t)) break;
if (s[k] == t[0]) {
for (p = k; s[p] != '\0'; p++) {
j = p;
while (s[j] != '\0' && s[j] == t[j-k] && t[j-k] != '\0') { j++; }
if (t[j-k] != '\0') { break; }
i = k;
}
}
}
printf("%d\n", i);
return 0;
}