Goto and switch in C

Go To

Go to

label_name:
.
.
.
goto label_name;

Switch-case

Switch-Case

int x;
switch(a)
{
	case 1:
	  x = 1;
	  break;
	case 2:
	  x = 0;
	  break;
	case 3:
	  x = 2;
	  break;
	default:
	  x = 5;
	  

}

If break isn’t used, all following cases will be run.