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 প্রোগ্রামিং কিভাবে করবে ?

ক্লাস 24 : তুমি এখন যে গুলি করতে পারো

CLASS 24: What You Can Do Now

You're now in the last chapter of this book. In this lesson you'll learn more about the C language from the following topics:

C Preprocessor এর ব্যবহার ও উপযোগিতা

In Chapter 2, "Writing Your First C Program," you learned how to use the #include preprocessor directive to include C header files. Since then, the #include directive has been used in every program in this book.

C প্রোগ্রামিং ও অ্যাডভান্স File অপারেশন

In last hour's lesson you learned the basics of reading and writing disk data files. In this lesson you'll learn more about communication with disk data files. The main topics discussed in this hour are

    Random access to files
    Reading or writing binary data

C প্রোগ্রামিং ও File অপারেশন

In Chapter 5, "Reading from and Writing to Standard I/O," you learned how to read or write characters through standard input or output. In this lesson you'll learn to read data from or write data to disk files. The following topics are discussed in this lesson:

Unions: বিসদৃশ Data সংগ্রহের অন্য উপায়

In the previous hour's lesson you learned how to store data of different types into structures. In this hour you'll learn another way to collect differently typed data items by using unions. You'll learn about the following topics in this lesson: