This section explains you the concept of 'goto' statement in C.
The goto statement is a jump statement which jumps from one point to another point within a function. The goto statement is marked by label statement. Label statement can be used anywhere in the function above or below the goto statement. You can see in the given example, we want to display the numbers from 0 to 9. For this, we have defined the label statement loop above the goto statement. The given program declares a variable n initialized to 0. The n++ increments the value of n till the loop reaches 10. Then on declaring the goto statement, it will jumps to the label statement and prints the value of n.
Here is the code:
Output will be displayed as:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: February 5, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles