Subj : Re: Software Job Market Myths To : comp.programming,comp.software-eng From : Joe Wright Date : Wed Aug 17 2005 11:02 pm Chris Sonnack wrote: > CTips writes: > > >>>>> char* strconcat(char* s1, char* s2) >>>>> { >>>>> char buf[256]; >>>>> >>>>> strcpy(buf, s1); >>>>> strcat(buf, s2); >>>>> >>>>> return buf; >>>>> } > > >>>>Firstly, the name is wrong. (Why?) >>> >>>Yep. (Conflicts with authority.) > > >>>>Secondly, some qualifiers are missing from the input parameters. >>>>(Which?) >>> >>>Yep. (I'm constantly wondering about stuff like that.) > > >>Sorry, you're both wrong about these two. Care to guess why? >> >>[Yes, its a little nit-picky, but as long as we're testing C >>programmers, we might as well get it right.] > > > Okay, I'll fessup--I'm stumped. > Me too, I think. 1. strconcat is reserved because it begins 'str' and a lower case character. 2. Both strcpy and strcat qualify their second 'src' argument as 'const char *'. 3. The killer is that 'char buf[256]' automatic and disappears with 'return buf;'. -- Joe Wright "Everything should be made as simple as possible, but not simpler." --- Albert Einstein --- .