112
6.3.1 Fundamental commands
abort()
PURPOSE
: Program termination.
FORMAT
: void abort();
EXPLANATION
:
1. Calling abort() function will cause the program to terminate immediately,
indicating an unsuccessful termination.
2. The following may occur: file buffers are not flushed, streams are not closed,
and temporary files are not deleted.
3. In ANSI C, abort() function is part of library stdlib.
exit()
PURPOSE
: Program termination.
FORMAT
: void exit();
EXPLANATION
:
1. Calling exit() function will cause the program to end normally.
2. In ANSI C, exit() function is part of library stdlib. And allows to pass a
parameter indicating the termination status to the operating system.
breakpt()
PURPOSE
: Stops program execution like in the TRACE mode.
FORMAT
: void breakpt();
EXPLANATION
:
1. The TRACE mode stops at each statement. I you just want to investigate a
certain statement of your program, you can add a breakpt() statement.
2. Program will stop showing the “Break?_” prompt. You can
- Press D to evaluate the content of variables. The “var>_” prompt allows you
entering the name of the variable you want to evaluate. Entering only
.
.
will
go back to the “Break?_” prompt.
- Press
.
.
to carry on program execution.
- Press T to enter TRACE mode (see TRON page 111)
3. breakpt() is not part of any ANSI C standard library.
SAMPLE PROGRAM
:
/* breakpt example */
main() {
int i=0,j=10;
while(i<=10) {
breakpt();
i++;
j—
}
}