The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Caipenghui <Caipenghui_c@163.com>
To: tuhs@minnie.tuhs.org,Toby Thain <toby@telegraphics.com.au>
Subject: Re: [TUHS] A c program problem
Date: Wed, 22 Aug 2018 23:46:58 +0800	[thread overview]
Message-ID: <9487ADB3-CE4F-4011-84AD-506A5EB64D11@163.com> (raw)
In-Reply-To: <7912176e-5895-aaa3-f973-83f88b12f196@telegraphics.com.au>

On August 22, 2018 11:40:18 PM GMT+08:00, Toby Thain <toby@telegraphics.com.au> wrote:
> On 2018-08-22 10:29 AM, cc wrote:
> > I want to figure out if the book is right or the compiler is right.
> > 
> > 	
> > cc
> 
> 
> Donald and Dan identified the issue in earlier replies.
> 
> $ cc foo.c -o foo
> $ ./foo
> 5050
> $ cat foo.c
> #include <stdio.h>
> int main(void)
> {
>        int i, sum = 0;
>        i = 1;
>        while ( i <= 100) {
>        sum = sum + i;
>        i++;
>        }
>        printf("%d\n", sum);
>        return 0;
> }
> 
> --Toby

Thank you very much for pointing this out, and I'm thrilled. Thank you for your kind help.


      reply	other threads:[~2018-08-22 15:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-22 12:01 cc
2018-08-22 12:24 ` Donald ODona
2018-08-22 12:54   ` Mark Longridge
2018-08-22 14:21 ` Dan Cross
2018-08-22 14:26   ` cc
2018-08-22 14:29     ` cc
2018-08-22 14:32       ` Ralph Corderoy
2018-08-22 14:34         ` cc
2018-08-22 15:40       ` Toby Thain
2018-08-22 15:46         ` Caipenghui [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9487ADB3-CE4F-4011-84AD-506A5EB64D11@163.com \
    --to=caipenghui_c@163.com \
    --cc=toby@telegraphics.com.au \
    --cc=tuhs@minnie.tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).