Code Comprehension
- From: jj@xxxxxxxxxxxx
- Date: 24 Aug 2006 18:07:27 -0700
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.
.
- Follow-Ups:
- Re: Code Comprehension
- From: gw7rib
- Re: Code Comprehension
- From: pete
- Re: Code Comprehension
- From: jimmaureenrogers@xxxxxxxxxxxxxxxx
- Re: Code Comprehension
- From: Thad Smith
- Re: Code Comprehension
- From: Phlip
- Re: Code Comprehension
- From: websnarf
- Re: Code Comprehension
- From: Bob Day
- Re: Code Comprehension
- From: Pascal Bourguignon
- Re: Code Comprehension
- From: wooks
- Re: Code Comprehension
- Prev by Date: Re: Linked list problem (puzzle)
- Next by Date: Re: Code Comprehension
- Previous by thread: Web Crawler Engineer with a Leading Web Ranking Company
- Next by thread: Re: Code Comprehension
- Index(es):