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


Groups > comp.lang.c > #75342

Re: Funny C Program

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: Funny C Program
Date 2015-11-08 10:58 -0500
Organization Self
Message-ID <563F7132.4010804@verizon.net> (permalink)
References (3 earlier) <lnr3k21ujq.fsf@kst-u.example.com> <4f00f36b-8b20-49e1-ad96-0a782787ac05@googlegroups.com> <563E25B0.8080504@verizon.net> <68f7c46c-0248-4dcd-8073-46a938d5e427@googlegroups.com> <563E9DA5.70603@verizon.net>

Show all headers | View raw


I'm sending this message to n0n3m4@gmail.com, listed as the contact
address for questions about C4droid, and also to the comp.lang.c usenet
newsgroup. Unless n0n3m4 has a usenet connection, his response will
probably not go to the group - but if he gives me permission, I will
repost it there.

A message was posted on comp.lang.c about the legality/meaning of some
code that produced unexpected results when compiled using C4droid. You
can find the full discussion at
<https://groups.google.com/forum/#!topic/comp.lang.c/DABEmqReVJQ>, but
it's not until the following message that the connection to C4droid was
revealed - it's mentioned on the web page referred to in the link.

On 11/07/2015 07:56 PM, James Kuyper wrote:
> On 11/07/2015 07:21 PM, jimzhou001@gmail.com wrote:
>> I'm sorry.Maybe I didn't say clearly.I met the barrier when trying to
>> initialize the array with "int monk[101]={0}".You can see more
>> details at
>> http://jimzhou001.blogspot.de/2015/11/funny-c-programcomparison-between.html?m=1
> 
> Yes - saying " I got into trouble not initializing." is not a good way
> of explaining that you got into trouble while initializing.
> 
> Unless I'm missing something (which is unfortunately entirely possible),
> the only possible problem with your code is that it doesn't terminate
> the output with a new-line character (7.21.2p2), but it's unusual for
> anything to go wrong for that reason, and quite bizarre that it would go
> wrong in this fashion.

In case you're unwilling to trust a link to an unknown web page, here's
the relevant details from the page it refers to. jimzhou001 passed the
following code to C4droid:

    include <stdio.h>
    int main(void)
    {
        int i,array[101]={0};
        for(i=1;i<101;i++)
            printf(" %d",array[i]);
        return 0;
    }

(I added some white space not present in the original program, to aid
readability)

As I understand it, the output from that program should consist of 100
repeats of " 0". jimzhou001 reports the output from that program using a
screen shot, so I can't cut and paste it here, but the output contains
100 numbers, each preceded by a single space, with the first 60 numbers
and last 4 numbers all 0. There's a long string of non-zero values
starting at the 61st position with "1 -1092757696 -1092757628 78752 19 ...".

Can you confirm and explain the behavior of this program when compiled
by C4droid?

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


Thread

Funny C Program jimzhou001@gmail.com - 2015-11-03 17:54 -0800
  Re: Funny C Program bartekltg <bartekltg@gmail.com> - 2015-11-04 05:28 +0100
    Re: Funny C Program Richard Heathfield <rjh@cpax.org.uk> - 2015-11-04 07:12 +0000
      Re: Funny C Program bartekltg <bartekltg@gmail.com> - 2015-11-04 13:25 +0100
        Re: Funny C Program bartekltg <bartekltg@gmail.com> - 2015-11-04 13:52 +0100
          Re: Funny C Program jimzhou001@gmail.com - 2015-11-04 06:36 -0800
    Re: Funny C Program jimzhou001@gmail.com - 2015-11-04 02:28 -0800
      Re: Funny C Program bartekltg <bartekltg@gmail.com> - 2015-11-04 13:25 +0100
    Re: Funny C Program Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-04 19:07 -0800
      Re: Funny C Program bartekltg <bartekltg@gmail.com> - 2015-11-05 09:48 +0100
        Re: Funny C Program Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-05 06:08 -0800
  Re: Funny C Program Richard Heathfield <rjh@cpax.org.uk> - 2015-11-04 07:04 +0000
    Re: Funny C Program jimzhou001@gmail.com - 2015-11-04 02:33 -0800
      Re: Funny C Program Richard Heathfield <rjh@cpax.org.uk> - 2015-11-04 10:57 +0000
        Re: Funny C Program jimzhou001@gmail.com - 2015-11-04 03:46 -0800
          Re: Funny C Program luser droog <luser.droog@gmail.com> - 2015-11-04 10:46 -0800
            Re: Funny C Program jimzhou001@gmail.com - 2015-11-04 15:14 -0800
  Re: Funny C Program brian.oakley@stonybrook.edu - 2015-11-04 12:37 -0800
    Re: Funny C Program jimzhou001@gmail.com - 2015-11-04 15:30 -0800
  Funny C Program jimzhou001@gmail.com - 2015-11-06 16:40 -0800
    Re: Funny C Program Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-07 01:04 +0000
      Re: Funny C Program Keith Thompson <kst-u@mib.org> - 2015-11-06 17:12 -0800
        Re: Funny C Program jimzhou001@gmail.com - 2015-11-06 18:47 -0800
          Re: Funny C Program James Kuyper <jameskuyper@verizon.net> - 2015-11-07 11:24 -0500
            Re: Funny C Program jimzhou001@gmail.com - 2015-11-07 16:21 -0800
              Re: Funny C Program Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-08 00:46 +0000
              Re: Funny C Program James Kuyper <jameskuyper@verizon.net> - 2015-11-07 19:56 -0500
                Re: Funny C Program jimzhou001@gmail.com - 2015-11-07 19:08 -0800
                Re: Funny C Program James Kuyper <jameskuyper@verizon.net> - 2015-11-08 10:58 -0500
                Re: Funny C Program James Kuyper <jameskuyper@verizon.net> - 2015-11-12 13:31 -0500
                Re: Funny C Program Keith Thompson <kst-u@mib.org> - 2015-11-12 11:59 -0800
                Re: Funny C Program jimzhou001@gmail.com - 2015-11-17 23:00 -0800
                Re: Funny C Program jimzhou001@gmail.com - 2015-11-18 00:12 -0800
                Re: Funny C Program Keith Thompson <kst-u@mib.org> - 2015-11-18 09:01 -0800
                Re: Funny C Program jimzhou001@gmail.com - 2015-11-17 23:00 -0800
    Re: Funny C Program James Kuyper <jameskuyper@verizon.net> - 2015-11-06 20:07 -0500

csiph-web