Goto

This is a discussion on Goto within the C++ Programming forums, part of the General Programming Boards category; How do I exactly use the goto token?...

  1. #1
    Unregistered
    Guest

    Question Goto

    How do I exactly use the goto token?

  2. #2
    Unregistered
    Guest
    Code:
    #include <iostream.h>
    
    int main()
    {
       loop:
       cout << "Hello world!"
       goto loop;
       return 0; // This code will never be reached.
    }
    This function will loop forever, but it illustrates the point. Try not to use gotos as much as possible.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    30
    Goto is an absoulte jump, mainly used in BASIC.

    The use of goto in c++ is considered bad programming practice.
    Homer

    D'OH!

    mmmmmmmm... iterations

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. temperature sensors
    By danko in forum C Programming
    Replies: 22
    Last Post: 07-10-2007, 07:26 PM
  2. goto command
    By jhwebster1 in forum C Programming
    Replies: 3
    Last Post: 02-21-2006, 11:32 AM
  3. Does goto have a glitch or...?
    By Blackroot in forum C++ Programming
    Replies: 9
    Last Post: 02-18-2006, 09:40 AM
  4. helpppp
    By The Brain in forum C Programming
    Replies: 1
    Last Post: 07-27-2005, 07:05 PM
  5. Need some help with a basic tic tac toe game
    By darkshadow in forum C Programming
    Replies: 1
    Last Post: 05-12-2002, 04:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21