Segmentation fault with structs and char pointers
Hello!
I've (quite) recently begun learning C++ and would appreciate some help with this following problem:
The code compiles fine but when run it gives me a "Segmentation fault".I hav'nt the slightest of where to begin looking for a fix!
Possible problem areas:
Code:
...
bool Equal(char*,char*); // Function prototype
int main()
{
...
Code:
...
bool Equal(char *str1,char *str2) //Is this the problem?
{
if(strlen1 != strlen2)
return(false);
for(int i=-1;++i<=strlen1; )
if(str1[i] != str2[i])
return(false);
return(true);
}
Full Source
My teacher thought it had something to do with the arguments to "bool Equal()". Any ideas as to the reason of the "Segmentation fault"?