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


Groups > comp.lang.c > #94301

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

From Ken Brody <kenbrody@spamcop.net>
Newsgroups comp.lang.c
Subject Re: while(source[i] != '\n' || source[i] != '\0') segmentation fault
Date 2016-09-30 10:55 -0400
Organization A noiseless patient Spider
Message-ID <nsluce$esp$1@dont-email.me> (permalink)
References <75ada694-4a58-4f1d-81d1-9490a709e75d@googlegroups.com>

Show all headers | View raw


On 9/30/2016 8:23 AM, alla.rashitova@gmail.com wrote:
> Hello!
>
> I don't understand why I get segmentation fault on my while loop
> while(source[i] != '\n' || source[i] != '\0')
> when i use it to run through the line, which is stored in an array.
[...]
>     while(source[i] != '\n' || source[i] != '\0')
>         i++;
[...]

Under what circumstance will the while condition be false?

-- 
Kenneth Brody

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