• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 303
  • Last Modified:

How to use GOTO ?

Hello there. Could anyone show me an example how i can use the GOTO in C ? Thanks.
0
andoryu
Asked:
andoryu
  • 5
  • 2
1 Solution
 
LockiasCommented:
int main()
{
   /*  Some code here */

   GOTO MyLabel;

   /* Some code here */

   MyLabel:

   /* Some code here */

   return 0;
}

~Lockias
0
 
LockiasCommented:
Sorry,
  "GOTO" should be "goto"

~Lockias
0
 
LockiasCommented:
However,
  I must say you should almost never use goto in C unless you are breaking out of some horrible nested loop or something like that.

~Lockias
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ahoffmannCommented:
Lockias, you *almost ever* have to use goto even in C when programming something like stated loops, finite state machine, etc.
(-:I'm picky, sometimes;-))
0
 
LockiasCommented:
Isn't that what I just said?
0
 
ahoffmannCommented:
ok, if i substitute "horrible nested loop" by "mealy machine" for example ;-)
Don't feel offended.
andoryu, sorry for chatting ...
0
 
andoryuAuthor Commented:
Thanks for everything guys. I just wanted to confirm because I can't find any examples related to GOTO in C earlier.
0
 
LockiasCommented:
Why is that only worth a B??
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now