News for hackers. Stuff that matters.
Re:Interviewing programmers: coding test example explained by gorrepati on Friday June 04, 2010 @02:58PM (#1405250)
I get access violation with VC, when trying to see how this works.

Works with gcc though.

Can somebody throw some light on how this works?

Re:Interviewing programmers: coding test example explained by RiderOfGiraffes on Saturday June 05, 2010 @09:35AM (#1406848)

  void condense_by_removing(char* s, char c)
  {
    char* d = s;
    while (*d = *s++)
      d += *d != c;
  }
It always does the copy, then evaluates *d!=c. If what it just copied is equal to the forbidden character this evaluates as false, which in C is 0, and hence d is left unchanged.

If what it copied is not equal then this evaluates as true, which is 1, and hence d is incremented.