Generally in Programming statements execute order wise. If developer don’t want to follow the sequence then have to instruction to compiler to jump the particular statement in coding. Goto is used to jump to that particular statement in coding.
There are 2 type of Jump:
1. Backward Jump:
Control goes back in coding from current statement.
Control goes forward in coding from current statement.
Example: This example represent both type of jump:
int a,c,x ;
printf(“enter the value of a “);
printf(“sorry negative no not allow: Please enter positiovr no again:”);
printf(“the value of a is %d”,a);
printf(“answer is %d”,x);
If user enter negative number then he/she will not allow to go ahead. Compiler push user to enter positive number again , so, control jump to back (input lable). When positive number will be entered then user can go ahead. There is also goto statement used. Which will display multiplication of variable c and a.
To learn more about C Language at TCCI.
Call us @ 9825618292
Visit us @ http://www.tccicomputercoaching.com