Code Comprehension



I regularly find myself staring at a bit of (usually terse) code for
frustratingly long periods of time before I can, hopefully, understand
what it does. Does this get easier with experience/practise? Is there
anything I can do to help improve things or am I just a bit dim?

Here's an example of the kind of thing I'm talking about, even knowing
what it does it takes me quite a while to figure out *how* it does it:

void fun(char *a, const char *b) {
int apos = 0, i, j;

if (!a || !b)
return;

for (i = 0; a[i]; i++) {
for (j = 0; b[j] && a[i] != b[j]; j++)
;
if (!b[j]) {
a[apos++] = a[i];
}
}

a[apos] = '\0';
}

Thanks.

.