Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #3953

Re: I need help

Message-ID <4DCE8B46.A58@mindspring.com> (permalink)
Date 2011-05-14 10:01 -0400
From pete <pfiland@mindspring.com>
Organization PF
Newsgroups comp.lang.c
Subject Re: I need help
References <e279cb75-8a72-4ad9-9877-62a9ca1b0dfe@glegroupsg2000goo.googlegroups.com>

Show all headers | View raw


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){
>    *(value ++)  = 0;
>    printf("%s=====%s\n", value, string);
> }
> else if((value == NULL) && (avalue = strchr(astring, ''))){
>   *(avalue ++) = 0;
>    printf("%s====%s\n", avalue, astring);
> }
> 
> Is the above correct?

It's close.

I think you misspelled (astring, ' ').

And the (value == NULL) expression is pointless,
since you already know that (value == NULL) is true,
if that part of the code is executing.

-- 
pete

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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