Is it possible to have a function that returns a value when one function calls it but doesn't return a value when some other function calls it?
Is it possible to have a function that returns a value when one function calls it but doesn't return a value when some other function calls it?
Not in C.
If you don't want the value being returned at any time, just don't "catch" the value, and it will be lost when the function returns.
result = myFunction(); //value returned is caught by "result" variable
myFunction(); //value returned is immediately lost
Make sense?
I thought if a function returns something then you must catch it?
1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
3. Get rid of conio.h and other antiquated DOS crap headers.
4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.