I'm currently learning C programming Language and I'm trying to understand this program here.
Simply, the function squeeze out any char that match between s1 and s2. The thing that I don't understand though is the loop cycles. If I increment j (j++) after the first cycle of the second loop, the first char of s2 is not compared to the others in s1, but just with the first one of s1, right?
Anyway the program works, but I just want to understand how it work out... Thanks in advance!
void squeeze2(char s[], char t[]){
int i, j, k;
for(i = k = 0; s[i] != ''; i++){
for(j = 0; t[j] != '' && t[j] != s[i]; j++)
;
if(t[j] == '')
s[k++] = s[i];
}
s[k] = '';
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…