Re: Clunky C cleanup code

From: Merrill & Michele (beckjensen_at_comcast.net)
Date: 11/30/04


Date: Tue, 30 Nov 2004 10:31:53 -0600


> "Mike Wahler"
> >"Merrill & Michele"
> > > "fatted"
> > > I've written a function (clean_string) to remove characters from a
> string,
> > > but it looks clunky to me, and I'm sure there's a more 'C' like way of
> > > doing it (still learning), comments and advice welcome...
> > >
> > > --
> > > #include <stdio.h>
> > > #include <stdlib.h>
> > > #include <string.h>
> > >
> > > int main(void)
> > > {
> > > char * clean_string(const char *, const
> > [single point to make, rest of post snipped]
> >
> > I get routinely chastised for defining functions inside of main().
>
> OP's code did not contain any function definitions inside of main
> or any other function.

Let me go through my premises. There are two return statements. This
implies .... What if I #defined 'definition' 'prototype declaration' in my
last post? MPJ