Search
 
SCRIPT & CODE EXAMPLE
 

C

goto statement in c

#include <stdio.h>

// The goto statement is known as jump statement in C.
// goto is used to transfer the program control to a predefined label.
// Try to avoid it because it as much as possible because it's used to alter-
// -the sequence of normal sequential execution and making a small mistake
// lead to endless iterations.

int main()
{
	int i = 0;
    repeat_from_here:		// the label ( destination )
    	printf("%d ",i++);
    if( i <= 10 )				// Until the condition is satisified
    	goto repeat_from_here;	// the control will jump to the label ( source )
	return 0;
}
Comment

C Syntax of goto Statement

goto label;
... .. ...
... .. ...
label: 
statement;
Comment

PREVIOUS NEXT
Code Example
C :: c strcat 
C :: PATH_MAX 
C :: c for loop 
C :: slug urls django 
C :: int_min in c 
C :: strcasecmp c 
C :: c convert char to int 
C :: ruby find object in array by attribute 
C :: how to open a file with open in c 
C :: int to char in c 
C :: number of hours, minutes, and seconds given the number of seconds. 
C :: print variable adress c 
C :: round float in c 
C :: selection sort algorithm in c 
C :: unable to locate package dos2unix 
C :: Bitwise Operators in C language 
C :: millis() 
C :: function array median 
C :: terraform fargate cpu 
C :: subrayar elementos css 
C :: arduino empty serial buffer 
C :: command args c 
C :: ternary operator in c 
C :: logical operators 
C :: bitwise operators 
C :: gandhi ashram saharanpur 
C :: what happens if i acess a freed variable in c 
C :: esp local control 
C :: C (GEM) 
C :: clipboard lib 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =