Re: embedded questions!!!
- From: "Chuck F. " <cbfalconer@xxxxxxxxx>
- Date: Thu, 12 Jan 2006 18:01:01 -0500
Rufus V. Smith wrote:
"#define" <u4karsh@xxxxxxxxx> wrote in message
Some C questions were bugging me from quite some time. Any answers! please share.
2. Given 2 Strings char *str1 = "JHONSON"; char *str2 = "O";
what is the fastest way to remove all occurences of letter O from str1.
str1[0] = '\0';
Bzzt - WRONG. str1 contains a pointer to a non-modifiable string (which may well reside in ROM). str1 itself contains no letter O. Thus the only way is:
str1 = "JHNSN";
Things would be different if the original declaration was:
char str1[] = "JHONSON";
which would have initialized a character array to a C string.
-- "If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers." - Keith Thompson More details at: <http://cfaj.freeshell.org/google/> .
- Follow-Ups:
- Re: embedded questions!!!
- From: John B
- Re: embedded questions!!!
- From: Paul Whitfield
- Re: embedded questions!!!
- References:
- Re: embedded questions!!!
- From: Rufus V. Smith
- Re: embedded questions!!!
- Prev by Date: problem accessing a specific CF Card (Compact Flash) in 8-bit TrueIDE mode
- Next by Date: Re: problem accessing a specific CF Card (Compact Flash) in 8-bit TrueIDE mode
- Previous by thread: Re: embedded questions!!!
- Next by thread: Re: embedded questions!!!
- Index(es):
Relevant Pages
|