How to understand what to put in the return statement? When to put return 0 and all return with other expressions? How to determine what to return? I mean how to determine what to put after return (?)? I just don’t understand what to return, I don’t understand what to write after return in parentheses return (?)? For example :
int find_substr(char *s1, char *s2) { register int t; char *p, *p2; for(t=0; s1[t]; t++) { p = &s1[t]; p2 = s2; while(*p2 && *p2==*p) { p++; p2++; } if(!*p2) return t; /* 1-й оператор return */ } return -1; /* 2-й оператор return */ } why is there a return -1, what does this -1 mean, why is there -1, and not 0 or not p? How do you understand in what circumstances and what to put after the return?