In the following code, I wrote a function recursively which should return a value, and really when two numbers are equal it returns, in the function I did not use the return and she is still working, I'd love to get an answer to why it works?
first of all, why are you using string.h?
second of all, dont use void main
third of all i think its just undefined behavior. what compiler are you using?
<string.h>
This is the C string functions. This file contains functions defined for the "C" programming language (Not C++), things like strlen() and strcpy().
<string>
This is the correct one to use as you will be able to do more with the C++ std::string class. Since you are programming in C++ you will want to use <string>.
Now if you intend to use <string.h> (Which I 99% suspect you don't) You would need to actually use <cstring>.
Now, why not to use void main(), the super simplified answer is that C++ kind of requires main() to return an int value. Just think of it this way. It is a standard that you are required to adhere to. In the same kind of standard that you cannot name your main() function superCOOLmainfunction(). It just has to be int main().
a) youre not using anything in it
b) thats a c library. the proper one would be <cstring>
c) if youre using c++, you might as well use <string> ie the std::string class. what version of g++ are you using?