answersLogoWhite

0

Labels are used in conjunction with goto statements. A goto statement allows us to jump forwards or backwards to a given label:

int x;

again:

printf ("Enter a non-zero number: ");

scanf ("%d\n", &x);

if (x==0)

{

printf ("Input error: number must be non-zero!\n");

goto again;

}

Goto statements should generally be avoided in favour of structured alternatives. The above example would be much better written using a loop:

int x = 0; while (x==0) {

printf ("Enter a non-zero number: ");

scanf ("%d\n", &x);

if (x==0) printf ("Input error: number must be non-zero!\n");

}

Goto statements are ideally suited to jumps out of a nested scope as an alternative to using multiple break statements.

while (true) {

// ...

while (true) {

// ...

if (z==42) goto end; // break out of both loops

}

}

end:

User Avatar

Wiki User

8y ago

What else can I help you with?

Related Questions

What is meant by c and c program?

cash and carry


What is meant by an pointer in c program?

Pointer is like variable address the members in memory shell


What is meant by TSR in C?

It means Terminate-Stay-Resident. A TSR is a program that remains in memory when the program ends.


What is the chemical symbol for carbon on a medicine label?

The chemical symbol for carbon on a medicine label is "C".


What is meant by alpha label on tax return?

What is meant by the alpha label on a tax return is the letters that are to the left of the filers social security number on an IRS label. These are used by the IRS to verify the filers social security number.


What is meant by a program?

putting a program on a computer or the internet


What is meant by console in c?

What you meant to ask is:What is mean by console application in Windows programming?Answer: a program that doesn't open a window on its own, but runs in a "black DOS-shell", like FTP.EXE and TELNET.EXE


C program was introduced in the year?

c program was introduced in the year 1972 by Dennis RitchieNo, it was the C language, not the C program.


Features of c program?

the features of a C program


What is the label of a carbon atom?

C


Which program is meant to replace SSH?

There is no particular program meant to replace SSH. SSH is considered a modern and secure program, so there is no reason to replace it.


What is meant by console application in c?

What you meant to ask is:What is mean by console application in Windows programming?Answer: a program that doesn't open a window on its own, but runs in a "black DOS-shell", like FTP.EXE and TELNET.EXE