Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Eric Sosman <esosman@ieee-dot-org.invalid> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: I need help |
| Date | 2011-05-14 10:19 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <iqm332$vm8$1@dont-email.me> (permalink) |
| References | <e279cb75-8a72-4ad9-9877-62a9ca1b0dfe@glegroupsg2000goo.googlegroups.com> |
On 5/14/2011 9:02 AM, janus wrote:
> Thanks you all.
>
> However, I have additional question ..
>
> Is this acceptable?
> char string[] = "Simulated Annealing = 857747716";
> char astring[] = "Karmarkar 625874153";
>
> char * value = strchr(astring ,'=');
> char * avalue;
>
> if(value != NULL){
Since `value' will be NULL, this part is not executed.
> *(value ++) = 0;
> printf("%s=====%s\n", value, string);
> }
> else if((value == NULL)&& (avalue = strchr(astring, ''))){
This is a syntax error. You probably meant ' ', not ''. (Also,
since "value != NULL" has already been found false, "value == NULL"
is sure to be true. There's no actual harm in making a test that
can only turn out one way, but it's silly.)
> *(avalue ++) = 0;
> printf("%s====%s\n", avalue, astring);
With the correction, this should print " 625874153====Karmarkar".
> }
>
> Is the above correct?
Impossible to say, since you haven't told us what you want
the code to do!
--
Eric Sosman
esosman@ieee-dot-org.invalid
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: I need help janus <emekamicro@gmail.com> - 2011-05-14 06:02 -0700
Re: I need help pete <pfiland@mindspring.com> - 2011-05-14 10:01 -0400
Re: I need help Columbus sailed the ocean China Blue <chine.bleu@yahoo.com> - 2011-05-14 07:03 -0700
Re: I need help Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-14 10:19 -0400
Re: I need help Keith Thompson <kst-u@mib.org> - 2011-05-14 10:59 -0700
csiph-web