Submitted by tushar pramanick on Fri, 03/08/2013 - 00:21

The goto Statement

I feel that this book would not be not complete without mentioning the goto statement, although I do not recommend that you use the goto statement unless it's absolutely necessary. The main reason that the goto statement is discouraged is because its usage may make the C program unreliable and hard to debug.

The following is the general form of the goto statement:

labelname:
   statement1;
   statement2;
   .
   .
   .
   goto  labelname;


Here labelname is a label name that tells the goto statement where to jump. You have to place labelname in two places: One is at the place where the goto statement is going to jump (note that a colon must follow the label name), and the other is the place following the goto keyword. You have to follow the same rules to make a label name as you name a variable or function.

Also, the place for the goto statement to jump to can appear either before or after the statement.

Related Items

C প্রোগ্রামিং এর putc() Function এর ব্যবহার

Using the putc() Function
The putc() function writes a character to the specified file stream, which, in our case, is the standard output pointing to your screen.

 

C প্রোগ্রামিংয়ের getchar() Function এর ব্যবহার

Using the getchar() Function
The C language provides another function, getchar(), to perform a similar operation to getc(). More precisely, the getchar() function is equivalent to getc(stdin).

 

The syntax for the getchar() function is

 

C প্রোগ্রামিংয়ে getc() Function এর ব্যবহার

Using the getc() Function
The getc() function reads the next character from a file stream, and returns the character as an integer.

 

The syntax for the getc() function is

 

C প্রোগ্রামিং এর double Data Type সম্পর্কে আলোচনা

The double Data Type
In the C language, a floating-point number can also be represented by another data type, called the double data type. In other words, you can specify a variable by the double keyword, and assign the variable a floating-point number.