ARM Technical Support Knowledge Articles

GOTO STATEMENT AND LABELS

Applies to: General Topics

Answer


Information in this article applies to:


QUESTION

I am trying to use labels in my C programs, but I get an error about an undefined label. My code looks like the following:

start: main() {
...
goto start;
...
}

What is the problem?

ANSWER

In C, goto statements may be used only within the same function. Your function should appear as follows:

main() {
start:
...
goto start;
...
}

Article last edited on: 2004-06-07 13:34:38

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential