Jump to content

Run-length encoding: Difference between revisions

m
→‎{{header|C}}: bugfixes ... hopely for all cases... :D
m (→‎{{header|C}}: a note)
m (→‎{{header|C}}: bugfixes ... hopely for all cases... :D)
Line 23:
char cp, c;
 
for(cp=c= *in++, i = 0, dl=0; l>=0 ; c = *in++, l-- ) {
if ( c == cp ) {
i++;
Line 38:
cp = c;
}
*out++ = i; *out++ = cp; dl += 2;
return dl;
}</lang>
Line 67 ⟶ 68:
int main()
{
char *d = malloc(2*strlen(o));
char *oc = malloc(strlen(o));
Line 99 ⟶ 100:
cp = c;
}
printf("%d%c", i, cp);
}</lang>
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.