Re: K&R2, exercise 1-19
- From: "Jonas" <spamhereplease@xxxxxxxxx>
- Date: Fri, 06 Apr 2007 08:47:50 GMT
"arnuld" <geek.arnuld@xxxxxxxxx> wrote in message
news:1175838049.731644.266830@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Apr 6, 10:26 am, "user923005" <dcor...@xxxxxxxxx> wrote:
If you typed in 'hi' then arr will contain:
[h][i][0]
i think you meant: [h][i][\0]
followed by MAXLENGTH-3 garbage characters.
what does that mean ?
[garbage][h][i][\0] OR [h][i][\0][garbage]
The latter.
Also, you are supposed to reverse the string in place.
i am doing it but it is not working
Actually, you're not. In-place means only using additional storage of
constant size; you are using additional storage of size O(n).
Hint:
call strlen() to find out how big it is.
can't, K&R2 have not discussed "strlen()" yet.
Then you need to find it in some other way. Hint: the string ends with
'\0'...
--
Jonas
.
- Follow-Ups:
- Re: K&R2, exercise 1-19
- From: arnuld
- Re: K&R2, exercise 1-19
- References:
- K&R2, exercise 1-19
- From: arnuld
- Re: K&R2, exercise 1-19
- From: user923005
- Re: K&R2, exercise 1-19
- From: arnuld
- K&R2, exercise 1-19
- Prev by Date: Re: While not ended
- Next by Date: Re: brain teasers
- Previous by thread: Re: K&R2, exercise 1-19
- Next by thread: Re: K&R2, exercise 1-19
- Index(es):
Relevant Pages
|