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


Groups > comp.std.c > #1877

Unimportant but amusing question

From Tim Rentsch <txr@alumni.caltech.edu>
Newsgroups comp.std.c
Subject Unimportant but amusing question
Date 2013-01-26 09:19 -0800
Organization A noiseless patient Spider
Message-ID <kfnlibfsvyj.fsf@x-alumni2.alumni.caltech.edu> (permalink)

Show all headers | View raw


Consider the following program:

    int x = 1;

    int
    main( int argc, char *argv[] ){
        int x;
        extern int x;
        x = 0;
        {  extern int x;  x = 2; }
        return  x;
    }

Which of these choices best describes the program:

   A. Constraint violation
   B. Undefined behavior
   C. Defined behavior
   D. Strictly conforming
   E. Proof that God exists

Please explain your answer.


Hint:  Read 6.2.2 p4 before answering.

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


Thread

Unimportant but amusing question Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-26 09:19 -0800
  Re: Unimportant but amusing question lawrence.jones@siemens.com - 2013-01-26 17:21 -0500
    Re: Unimportant but amusing question Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-28 10:46 -0800
      Re: Unimportant but amusing question Bart van Ingen Schenau <bart@ingen.ddns.info.invalid> - 2013-01-29 10:06 +0000
      Re: Unimportant but amusing question "Derek M. Jones" <derek@_NOSPAM_knosof.co.uk> - 2013-01-29 12:45 +0000

csiph-web