goto statement in C

goto articulation in C

By utilizing goto articulation you can move the control of program anyplace. This watchword isn’t prescribed to use in any circumstance.

Sentence structure

goto name;

. . . .

. . . .

name: explanation;

Why you ought to stay away from goto explanation in C?

It assumes the responsibility for the program anyplace and whenever which isn’t useful for programming advancement life cycle.

In this cycle, a program needs to investigate and re-test a ton of times.

Also, with the utilization of goto catchphrase, it makes extremely difficult to troubleshoot the program.

Let’s make one program to get it.

#include<stdio.h>
 
void main()
{
 int i=1;
 
 if(i==1)
  goto one;
 else if(i==2)
  printf("2");
 else
  printf("Its nothing");
 
 one:
 printf("Avoid goto keyword");
}

Output

Avoid goto keyword

This watchword is commonly used to take the control outside the circle. That is it. Else you ought to keep away from this catchphrase.

Leave a Comment

error: Alert: Content is protected!!