go to in c programming

21 Aug 2022 Balmiki Mandal 0 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

  1. set a lebel (label name: )
  2. called a lebel;(go to label name; )

     Note:

  • should not be a constant
  • should not be a keyword

Two Types of go-to statements

  1. forward go to
  2. 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

  1. write a program to display the multiplication table of a given number using a go to 
  2. write a program to print the binary format using a go to 

BY: Balmiki Mandal

Related Blogs

Post Comments.

Login to Post a Comment

No comments yet, Be the first to comment.