I expect "match!" when the n2 tail is the same that the n1 tail, otherwise, "do not match!".
Example of "match!": n1 = 123456 and n2 = 3456.
The problem is when I enter, for example, n1 = "45" and n2 = "645". It should not match, but the output is "match!". 
bool different_tail = false;
char n1[11], n2[11];
cin >> n1 >> n2;
for(int i = strlen(n1)-strlen(n2); i < strlen(n1); i++){
  if(i < 0 || n1[i] != n2[i-(strlen(n1)-strlen(n2))]){
    different_tail = true;
    break;
  }
}
if(different_tail)
  cout << "does not match!" << endl;
else
  cout << "match!" << endl;
I don't want to use other ways to solve the problem (like, strcmp, etc...), I want to understand what's happening.
 
     
     
     
    