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


Groups > comp.lang.c > #94303

Re: while(source[i] != '\n' || source[i] != '\0') segmentation fault

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: while(source[i] != '\n' || source[i] != '\0') segmentation fault
Date 2016-09-30 16:04 +0100
Organization A noiseless patient Spider
Message-ID <878tu98m46.fsf@bsb.me.uk> (permalink)
References <75ada694-4a58-4f1d-81d1-9490a709e75d@googlegroups.com> <871t01a5fo.fsf@bsb.me.uk> <ce36989e-5a6a-4afd-8381-332ca0ee60e5@googlegroups.com>

Show all headers | View raw


Alla _ <modelling.data@gmail.com> writes:

> <snip>
> Thank you very much for your reply! I see that my mistake has nothing to do 
> with my understanding of logical operators (thank goodness I have no issues
> with those), but with my usual habit (which is unfortunately still there) of not
> seeing my simple mistakes - of course, if the source[i] = '\n',
> then the source[i+1] = '\0', not source[i].

What I advised is a general strategy.  Please apply it to your new
condition and you will see that it is still wrong (though in a very
different way).

-- 
Ben.

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


Thread

while(source[i] != '\n' || source[i] != '\0') segmentation fault alla.rashitova@gmail.com - 2016-09-30 05:23 -0700
  Re: while(source[i] != '\n' || source[i] != '\0') segmentation fault Alla _ <modelling.data@gmail.com> - 2016-09-30 05:27 -0700
  Re: while(source[i] != '\n' || source[i] != '\0') segmentation fault Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-30 14:22 +0100
    Re: while(source[i] != '\n' || source[i] != '\0') segmentation fault mark.bluemel@gmail.com - 2016-09-30 06:37 -0700
      Re: while(source[i] != '\n' || source[i] != '\0') segmentation fault Alla _ <modelling.data@gmail.com> - 2016-09-30 07:49 -0700
      Re: while(source[i] != '\n' || source[i] != '\0') segmentation fault Keith Thompson <kst-u@mib.org> - 2016-09-30 09:16 -0700
        Re: while(source[i] != '\n' || source[i] != '\0') segmentation fault Jerry Stuckle <jstucklex@attglobal.net> - 2016-09-30 14:41 -0400
    Re: while(source[i] != '\n' || source[i] != '\0') segmentation fault Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-30 06:59 -0700
    Re: while(source[i] != '\n' || source[i] != '\0') segmentation fault Alla _ <modelling.data@gmail.com> - 2016-09-30 07:46 -0700
      Re: while(source[i] != '\n' || source[i] != '\0') segmentation fault Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-30 16:04 +0100
  Re: while(source[i] != '\n' || source[i] != '\0') segmentation fault Ken Brody <kenbrody@spamcop.net> - 2016-09-30 10:55 -0400
  Re: while(source[i] != '\n' || source[i] != '\0') segmentation fault Barry Schwarz <schwarzb@dqel.com> - 2016-09-30 09:34 -0700

csiph-web