Re: Really **wonderful** website for C interview questions!!!!!
- From: "Suman" <skarpio@xxxxxxxxx>
- Date: 23 Jun 2005 07:07:13 -0700
Richard Bos wrote:
> rajanarayan2005@xxxxxxxxx wrote:
>
> > I just found the BEST and the MOST comprehensive
> > website for C related questions and their answers. It
> > has a VERY, VERY, VERY good collection of the MOST
> > FREQUENTLY ASKED interview questions.
>
> Caveat Lector. I just looked at five of the questions on that page, and
> of those, four of the answers cause undefined behaviour, don't work as
> advertised, or are otherwise inferior. While it's perfectly possible
> that invoking UB in your interview will actually be to your advantage if
> you're trying to get a job with, say, Microsoft or IBM, you wouldn't get
> past my desk if you tried them on me.
>
> Richard
On the same note: have a look at the strlen() function they have (at
the
risk of generating even more revenue for the owner of this page,
but we have done him a lot of good already, so...)
/* code on their site */
int strlen(char *string)
{
char *p=string;
while(*p!='\0')
p++;
return(p-s);
}
and check with (as it is somewhat closer to, the signature part)
/* code from K&R, a not-so-old version */
int strlen(char *s)
{
int n;
for (n = 0; *s != '\0', s++)
n++;
return n;
}
as well as the signature of what we have on most systems ...
size_t strlen(const char *s).
This might just tempt you all the more to stay away!
Regards,
Suman.
P.S: Don't flame me for pulling down K&R, to their standard & win the
argument by sheer experience.
.
- Follow-Ups:
- References:
- Really **wonderful** website for C interview questions!!!!!
- From: rajanarayan2005
- Re: Really **wonderful** website for C interview questions!!!!!
- From: Richard Bos
- Really **wonderful** website for C interview questions!!!!!
- Prev by Date: Re: the usage of void argument
- Next by Date: Re: looking for free C debugger
- Previous by thread: Re: Really **wonderful** website for C interview questions!!!!!
- Next by thread: Re: Really **wonderful** website for C interview questions!!!!!
- Index(es):
Relevant Pages
|