Clouds
Home
Tutorial of C language
Computer Language
Introduction to C
Programming in C
Structure of C program
Variable in C
Datatypes in C
Token in C
Operator in C
Precedence of C Operator
Assignment Operator in C
Logical Operator in C
Bitwise Operator in C
Ternary Operator in C
C Input Output
Pointers in C
Storage Classes of C
Control Structure of C
C Decision Making Statement
C Looping Statement
C Jumping Statement
C Function
Function Call By Value
Function Call By Reference
C Input Output Function
C Structure
Array in C
Union in C

Jumping statement

Goto Statement

Example:-

				#include<stdio.h>
				#include<conio.h>
				void main()
				{
				 	int a,b;
				 	clrscr();
				 	printf("Enter the value of a:");
				 	scanf("%d",&a);
				 	printf("Enter the value of b:");
				 	scanf("%d",&b);
				 	if(a>b)
				 		goto output1;
				 	else
				 		goto output2;
				 	output1:
						printf("Highest value is a");
						goto end;
				 	output2:
						printf("Highest value is b");
				 	end:
				 		getch();
				 }
				

Continue

				#include<stdio.h>
				#include<conio.h>
				void main()
				{
				 	int i;
				 	clrscr();
				 	for(i=1;i<=10;i++)
				 	{
				  		if(i%3==0)
				  			continue;
				  		else
				  			printf("%d",i);
				 	}
				 	getch();
				}
				

Output:- 1 2 4 5 7 8 10
				#include<stdio.h>
				#include<conio.h>
				void main()
				{
				    int i;
				    int j = 10;
				    for( i = 0; i <= j; i ++ )
				    {
				       if( i = = 5 )
				       {
				          continue;
				       }
				       printf("Hello %d\n", i );
				    }
				}
				

Note: continue -skip 1 iteration of loop.

Break

If a condition is met in switch case then execution continues on into the next case clause also if it is not explicitly specified that the execution should exit the switch statement. This is achieved by using break keyword. You can come out of the switch block if your condition is met. This can be achieved using break statement. Try out following example: Note: break - exit from loop or switch.

Example:-

				#include<stdio.h>
				#include<conio.h>
				void  main()
				{
					int i;
				 	clrscr();
				 	for(i=1;i<=10;i++)
				 	{
				  		if(i%3==0)
				  			break;
				  		else
				  			printf("%d",i);
				 	}
				 	getch();
				}
				

Output :- 1 2

Example:-

				void  main()
				{
					int  Grade = 'B';
				    switch( Grade )
				    {
				        case 'A' : printf( "Excellent\n" );
				                       break;
				        case 'B' : printf( "Good\n" );
				                       break;
				        case 'C' : printf( "OK\n" );
				                       break;
				        case 'D' : printf( "Mmmmm....\n" );
				                   break;
				        case 'F' : printf( "You must do better than this\n" );
				                   break;
				        default  : printf( "What is your grade anyway?\n" );
				                   break;
				     }
				 }
				

C Function >>
Function Call By Value >>
Function Call By Reference >>
C Input Output Function >>
C Structure >>


Home Clouds