Here's an example of something that I wrote, to convert escape sequences in a string into the characters they represent. In the for loop, I stop whenever t[ti] != '\0'. Usually it will just increment ti by one at the end of an iteration, but if there is an escape sequence ("\t" or "\n"

in the string, I would want to convert those two characters into the single character that they represent, so I increment ti by one more.
/* unescape: copy string t to s, changing newline and tab escape sequences into
newlines and tabs, returns index of string-terminating '\0' in s[] */
int unescape(char s[], char t[])
{
int si = 0, ti; /* indices for s and t, respectively */
for (ti = 0; t[ti] != '\0'; ++ti)
if (t[ti] == '\\')
switch (t[ti + 1]) {
case 't':
++ti;
s[si++] = '\t';
break;
case 'n':
++ti;
s[si++] = '\n';
break;
default:
s[si++] = '\\';
break;
}
else
s[si++] = t[ti];
s[si] = '\0';
return si;
}