How To Use Goto Function In Dev C++

Jan 30, 2011  gotoxy is a standard C function defined in, but it will not work in ANSI C compilers such as Dev-C. Because gotoxy is a Turbo-C specific function, which means it is not part of the standard. However, if you insist on using console functions, you can define your own function by using member. However using gotoxy funxtion is quiet difficult in devc because there is no such header file present in dev c to use gotoxy function what we have to all do is that we have to create the function for positioning cursor in devc.

How To Use Goto Function In Dev C++
  • C++ Basics
  • C++ Object Oriented
  • C++ Advanced
  • C++ Useful Resources

How To Use Goto Function In Dev C File

  • Selected Reading

A goto statement provides an unconditional jump from the goto to a labeled statement in the same function.

NOTE − Use of goto statement is highly discouraged because it makes difficult to trace the control flow of a program, making the program hard to understand and hard to modify. Any program that uses a goto can be rewritten so that it doesn't need the goto.

Syntax

How To Use Goto Function In Dev C Download

The syntax of a goto statement in C++ is −

Where label is an identifier that identifies a labeled statement. A labeled statement is any statement that is preceded by an identifier followed by a colon (:).

Flow Diagram

Example

When the above code is compiled and executed, it produces the following result −

One good use of goto is to exit from a deeply nested routine. For example, consider the following code fragment −

Eliminating the goto would force a number of additional tests to be performed. A simple break statement would not work here, because it would only cause the program to exit from the innermost loop.

How To Use Goto In Excel

cpp_loop_types.htm