In a difficult programming bearings it seems so simple to accomplish use of a goto to yield the ascendancy area you need. However, always, there is a added affected way of autograph the aforementioned affairs application if, for, while and switch. These constructs are far added analytic and aboveboard to understand.
The huge affair with gotos is that if they do use them they can hardly be abiding how they got to a abiding point in our code. They abstruse the breeze of control. The GOTO keyword is basically used to get over a certain set of instructions instantly.a program illustrating this is shown below:
/*Demonstration of goto keyword*/
main
{
int m, n, l ;
for ( m = 1 ; m <= 3 ; m++ )
{
for ( n = 1 ; n <= 3 ; n++ )
{
for ( l = 1 ; l <= 3 ; l++ )
{
if ( m == 3 && n == 3 && l == 3 )
goto out ;
else
printf ( "%d %d %d\n", m, n, l ) ;
}
}
}
out :
printf ( "Out of the loop" ) ;
}
Sunday
//
Labels:
C LANGUAGE
//
0
comments
//
0 comments to "THE GOTO STATEMENT IN C LANGUAGE"
Powered by Blogger.
Blog Archive
-
▼
2011
(50)
-
▼
July
(38)
- INTRODUCTION TO C
- DATA SETS IN C
- DATA TYPES
- VARIABLES
- SIMPLE C PROGRAM
- PROGRAM USING SCANF() AND PRINTF()
- C INSTRUCTIONS
- INTRODUCTION TO DECISION CONTROL STRUCTURES
- IF STATEMENT
- IF STATEMENT PROGRAM
- IF ELSE STATEMENT
- NESTED IF ELSE
- DETERMINING ROOTS OF AN EQUATION
- ELSE IF STATEMENT
- LOGICAL AND ARITHMETIC OPERATORS
- CONDITIONAL OPERATORS
- LOOPS
- THE WHILE LOOP
- The for bend specify things about a bend in a ind...
- EXAMPLE OF FOR LOOP
- NESTING OF LOOPS
- THE ODD LOOP
- THE DO-WHILE LOOP
- BREAK STATEMENT IN C
- THE CONTINUE STATEMENT IN C
- SWITCH STATEMENT IN C
- SIMPLE PROGRAM SHOWING SWITCH STATEMENT
- THE GOTO STATEMENT IN C LANGUAGE
- FUNCTIONS IN C LANGUAGE
- CALLING FUNCTIONS IN C LANGUAGE
- CALL BY REFERENCE IN C LANGUAGE
- POINTERS IN C LANGUAGE
- SIMPLE PROGRAM SHOWING POINTER IN C LANGUAGE
- PROGRAM FOR FUNCTION CALL BY REFERENCE IN C
- SWAPPING OF TWO NUMBERS IN C
- RECURSION IN C LANGUAGE
- FACTORIAL OF A NUMBER WITHOUT RECURSION IN C
- ARRAYS IN C LANGUAGE
-
▼
July
(38)
Post a Comment