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


Groups > comp.lang.c > #109878

Re: What am I doing wrong here?

Path csiph.com!news.redatomik.org!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!feeds.phibee-telecom.net!border2.nntp.ams1.giganews.com!nntp.giganews.com!buffer2.nntp.ams1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date Sat, 13 May 2017 08:19:07 -0500
From Gareth Owen <gwowen@gmail.com>
Newsgroups comp.lang.c
Subject Re: What am I doing wrong here?
References <of62cn$4ji$3@dont-email.me> <ennoubFn8ntU1@mid.uni-berlin.de> <of6vp1$m8g$2@dont-email.me>
Date Sat, 13 May 2017 14:19:06 +0100
Message-ID <87o9uwnbcl.fsf@gmail.com> (permalink)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
Cancel-Lock sha1:HDVHZopXv0tUaNL1bA5WvCqiezQ=
MIME-Version 1.0
Content-Type text/plain
Lines 22
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-YKuNcO6YvyyeA7ypAW8PiMyaFtPdKPFbVV0p3snPszRYZXxvveAFu5+Vv4WEV/vG/VUFQU+taJkjEGv!RnqCClph7tss4zJx88G6FaLQ1Qw5rOLzJ65p/VfCxBA5vLfCRNEWy+AiG7NGQl4rHNHoVD4=
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 1608
Xref csiph.com comp.lang.c:109878

Show key headers only | View raw


DFS <nospam@dfs.com> writes:

> int main(int argc, char *argv[])
> {
>
>   int i;
>   char *randName[2];

This is an array of 2 unitialised pointers, that never get initialised.
You want

char randname[2]; /* 2 bytes of storage for writing a letter and a NULL-byte */

>   int  randRate[8];

char randRate[3];   /* you're writing a string representation of an int,
                       so you need a string / array of chars to write it
                       to - 3 bytes for two digits and NULL-byte*/

>   char *randJob[11];

char randJob[11];             /* 11 bytes of storage */

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


Thread

What am I doing wrong here? DFS <nospam@dfs.com> - 2017-05-13 00:39 -0400
  Re: What am I doing wrong here? DFS <nospam@dfs.com> - 2017-05-13 01:03 -0400
  Re: What am I doing wrong here? jt@toerring.de (Jens Thoms Toerring) - 2017-05-13 06:55 +0000
    Re: What am I doing wrong here? DFS <nospam@dfs.com> - 2017-05-13 08:59 -0400
      Re: What am I doing wrong here? bartc <bc@freeuk.com> - 2017-05-13 14:15 +0100
      Re: What am I doing wrong here? Gareth Owen <gwowen@gmail.com> - 2017-05-13 14:19 +0100
        Re: What am I doing wrong here? DFS <nospam@dfs.com> - 2017-05-13 11:06 -0400
          Re: What am I doing wrong here? Manfred <noname@invalid.add> - 2017-05-13 17:38 +0200
            Re: What am I doing wrong here? DFS <nospam@dfs.com> - 2017-05-13 13:38 -0400
              Re: What am I doing wrong here? bartc <bc@freeuk.com> - 2017-05-13 19:03 +0100
          Re: What am I doing wrong here? bartc <bc@freeuk.com> - 2017-05-13 16:43 +0100
      Re: What am I doing wrong here? Barry Schwarz <schwarzb@dqel.com> - 2017-05-13 07:44 -0700
        Re: What am I doing wrong here? DFS <nospam@dfs.com> - 2017-05-13 11:25 -0400
          Re: What am I doing wrong here? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-05-13 19:23 +0100
    Re: What am I doing wrong here? Keith Thompson <kst-u@mib.org> - 2017-05-13 13:58 -0700
      Re: What am I doing wrong here? jt@toerring.de (Jens Thoms Toerring) - 2017-05-13 23:43 +0000
        Re: What am I doing wrong here? Tim Rentsch <txr@alumni.caltech.edu> - 2017-05-14 13:43 -0700
  Re: What am I doing wrong here? DFS <nospam@dfs.com> - 2017-05-15 20:18 -0400

csiph-web