Difference in value of str[i] after for loop on writing int i and just i in for loop.i

Why does the value of i after for loop becomes 0 if we write int i in the loop?
However if we just write i in for loop it gives updated value of i

using namespace std;
int main() {
char s[1000];
cin>>s;
int i=0;
for(i=0;s[i+1]!=’\0’;i++)
{ int c=s[i+1];
int b=s[i];
int n=c-b;
cout<<s[i]<<n;
}

cout<<s[i];

return 0;

}

please share code through ide.codingblocks.com

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.