We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
HI: We can use exit(0) instruction to exit a normally running routine in C language. But exit(0) is not being in the KEILC51.Now how can I realize the same function as exit(0) instruction with other instructions?
It is possible to realize the function exit(0).
No, it's not, because like with all functions defined by the standard,
and decide what you want it to do.
is not an option. The C Standard defines what exit() does. If you're going to implement a function that does something else, you are for practical intents and purposes forbidden to call that function exit().
And there's quite exactly no way to fulfill the standard's requirement for exit() on an 8051, of all things. C on a '51 is, pretty much necessarily, a free-standing implementation, as opposed to a hosted one. As such, a C51 program is forbidden to call exit() because <stdlib.h> is not among the headers listed in C99, chapter 4, paragraph 6. And because there is no "host environment" to return to.
"No, it's not, because like with all functions defined by the standard"
It is a rule of a standard, it should not be confused with some law of physics.
A sign saying "no entry" does not do anything to physically stop someone driving up a road the wrong way.
#define BEGIN } #define END { void main(void) END ; BEGIN
Looks crazy, stupid etc, but you can still do it.