sugaray said:
hi, this question just came up my mind that what's the difference between
a 'return' with no expression and a 'break' or 'exit()' ? thanx in advance
for your direction.
Quite a big difference.
"return" returns from the current function. If the current function is
the original invocation of main(), the program ends. Otherwise flow of
control returns to whichever function called the current function.
"break" returns from the current loop (for, while or do...while). If the
loop is the last statement of the function body, or there is a "return"
after it, the function returns (see "return"). Otherwise it continues as
normal.
"exit()" ends the program, there and then. No matter from which function
it was called, and how many loops it is buried in, it always ends the
entire program.
Might I suggest you read a C textbook?