Take look at the code that follows.
"Hello " "World!";
"The number is ", 37;
int x=23;
char *y="232";
x,x+2,x*3;
atoi(y) - x;
It is a perfectly valid fragment of C(99) source. But! All that expressions return to nowhere! How can one trace or even use all this anonymous values? Where are they stored and what is their purpose?
So when you write small programs, they execute very fast. When the execution is completed, the program exits immediately and hence they close. To prevent this, you can type the following at the end of your main function, before the 'return 0;' line, if you are using one in your code. at the beginning of your code.
No. A "break" is not an int, so it cannot be returned by your function.
Stack overflow occurs when − C) If a function is called recursively by itself infinite times then stack will be unable to store large number of local variables, so stack overflow will occur − void calculate(int a) { if (a== 0) return; a = 6; calculate(a); } int main() { int a = 5; calculate(a); }
These values go nowhere. You can not retrieve them. In fact, most are optimized out by the compiler.
That entire fragment can be simplified to atoi("232") because function calls usually can't be optimized out.
Those particular expressions are useless. On the other hand, this is allowed because some expressions have side effects(and perhaps return values), and sometimes only the side effect is needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With