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


Groups > comp.lang.c > #67951

Re: programming in c: array; for loop to initialize values

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: programming in c: array; for loop to initialize values
Date 2015-08-21 10:22 -0700
Organization None to speak of
Message-ID <lnk2so1rqr.fsf@kst-u.example.com> (permalink)
References <43dff05d-eda8-4a4d-b9e5-4de3e9e9f21e@googlegroups.com> <f1ad4ae3-94e1-4f09-bd2c-2014ab6c8f2e@googlegroups.com>

Show all headers | View raw


Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
[...]
> It's a bit confusing.
> Arrays start off with all elements random garbage, unless you tell
> the compiler differently.
[...]

A quibble: it's *arbitrary* garbage, not random garbage.  You can't
meaningfully predict the initial values of an uninitialized array, but
if you try to use those values as random numbers it won't turn out well.
It's even possible that the initial contents will happen to be all zeros.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

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


Thread

programming in c: array; for loop to initialize values Alla _ <modelling.data@gmail.com> - 2015-08-20 10:22 -0700
  Re: programming in c: array; for loop to initialize values "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-20 10:29 -0700
    Re: programming in c: array; for loop to initialize values Alla _ <modelling.data@gmail.com> - 2015-08-20 11:26 -0700
      Re: programming in c: array; for loop to initialize values "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-20 11:37 -0700
      Re: programming in c: array; for loop to initialize values Barry Schwarz <schwarzb@dqel.com> - 2015-08-20 16:47 -0700
        Re: programming in c: array; for loop to initialize values Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-06 13:38 -0700
          Re: programming in c: array; for loop to initialize values Barry Schwarz <schwarzb@dqel.com> - 2015-09-07 12:38 -0700
            Re: programming in c: array; for loop to initialize values Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-07 23:00 -0700
  Re: programming in c: array; for loop to initialize values jt@toerring.de (Jens Thoms Toerring) - 2015-08-20 17:32 +0000
    Re: programming in c: array; for loop to initialize values Alla _ <modelling.data@gmail.com> - 2015-08-20 11:27 -0700
  Re: programming in c: array; for loop to initialize values Keith Thompson <kst-u@mib.org> - 2015-08-20 12:44 -0700
    Re: programming in c: array; for loop to initialize values "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-20 13:34 -0700
    Re: programming in c: array; for loop to initialize values Alla _ <modelling.data@gmail.com> - 2015-08-21 04:03 -0700
  Re: programming in c: array; for loop to initialize values Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-21 02:08 -0700
    Re: programming in c: array; for loop to initialize values Keith Thompson <kst-u@mib.org> - 2015-08-21 10:22 -0700
      Re: programming in c: array; for loop to initialize values James Kuyper <jameskuyper@verizon.net> - 2015-08-21 13:17 -0400
  Re: programming in c: array; for loop to initialize values Alla _ <modelling.data@gmail.com> - 2015-08-21 04:07 -0700

csiph-web