Re: Goto case?

Discussion in 'C++' started by siddhant3s, Nov 2, 2009.

  1. siddhant3s

    siddhant3s Guest

    On Nov 3, 3:33 am, Paul N <> wrote:
    > If I'm within a switch, then saying "case 10:" creates a sort of
    > label. Is it possible to jump directly to one of these, eg "goto case
    > 12;"? I realise this can be done by adding a "normal" label next to
    > the "case" label, and that it might be possible to arrange a similar
    > thing by cunning use of fall-through or by changing the variable and
    > executing the switch again, but is there a neat syntax to jump to one
    > of the other cases?
    >
    > Thanks.
    > Paul.


    A C++ program may be containing more than one switch construct. And
    there is a posiblity to find statements such as 'case 1:' in more than
    one switch constructs. Hence it if at all this feature was there, it
    would have been ambiguous for the compiler.
    I don't see a point in considering a `case #n' as a `label'; just
    because it terminates with a colon?

    In short I would reply your last question with No.
     
    siddhant3s, Nov 2, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Franks
    Replies:
    2
    Views:
    1,257
    Steve Franks
    Jun 10, 2004
  2. Replies:
    2
    Views:
    406
  3. Replies:
    10
    Views:
    537
    Flash Gordon
    Aug 15, 2007
  4. Paul N

    Goto case?

    Paul N, Nov 2, 2009, in forum: C++
    Replies:
    4
    Views:
    2,859
    Bill Davy
    Nov 4, 2009
  5. Replies:
    31
    Views:
    228
    Tim Rentsch
    Apr 15, 2014
Loading...

Share This Page