go to in c programming
Go-to control statements:
go-to control statement is an unconditional Non-iterative control statement. go to also call as local go to
syntax: Two points we need to take care
set a lebel (label name: )
called a lebel;(go to label name; )
Note:
- should not be a constant
- should not be a keyword
Two Types of go-to statements
- forward go to
- backward go to
Forward go to : if first calling the label after that setting the label is called forward Go to
program:
#include
void main()
{
printf("hello...\n");
L1:sleep(1);
printf("Hai....\n")
go to L1;
}
Attension:
Backward go to label: if first setting label after that you call the label in called backward label
syntax:
program
#include
void main()
{
printf("hello...\n");
go to L1;
sleep(1);
printf("Hai....\n")
L1:
printf("bye...\n")
}
some programs on go to statements
- write a program to display the multiplication table of a given number using a go to
- write a program to print the binary format using a go to