.Net, All Engineering Branch, Basic computer course, basic knowledge of networking, c coaching in bopal, C programming language, c++ language, coaching class for C, coaching class in Ahmedabad, computer class in bopal-ahmedabad, computer class in satellite-ahmedabad, computer coaching in Ahmedabad, Computer Engineering Coaching, Engineering Courses, goto statement in C Language, HTML, Java, learn C Online, learn Programming Languages at TCCI, PHP coaching, programming language, Python, TCCI Coaching Institute

Goto statement in C – tccicomputercoaching.com

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.

Goto-statement-C_simple

There are 2 type of Jump:

1. Backward Jump:

Control goes back in coding from current statement.

2.Forward Jump:

Control goes forward in coding from current statement.

Syntax:

goto lable;

Example: This example represent both type of jump:

#include<stdio.h>

#include<conio.h>

void main()

{

int a,c,x ;

clrscr();

input:

printf(“enter the value of a “);

scanf(“%d”,&a);

if(a<0)

{

printf(“sorry negative no not allow: Please enter positiovr no again:”);

goto input;

}

else

{

goto print;

}

printf(“the value of a is %d”,a);

print:

c=6;

x=c*a;

printf(“answer is %d”,x);

getch();

}

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