What exactly happens in this program
according to me *s1++ = *s2++ will increment the pointer not the value pointed by it and then it stores the s2++ address inn to it.
while(*s1++ = *s2++);
But i dont know how the while loop is ending...it is supposed to be an infinite loop since we are assigning s1 and s2 and not comparing any condition ????
I am confused how the str1 points to rome at the end printf statement
Please explain me what really happens at the back ???
while(x = y) evaluates the same as while((x = y) != 0), and aside from x getting the value of y, it's the same as while(y != 0). The fact that you are using pointers and autoincrement doesn't change this basic principle.
Rome is also longer than 2 characters - 5 is the correct number here.
Also note that if you were to use, say, Napoli instead of Rome, you would have to specify a longer space for str1, as it is longer than "Italy".