#include <iostream>
usingnamespace std;
bool is_equal(char **str1, char **str2){ // i have added (*) on each parameter
int i;
for( i=0; str1[i]!='\0' && str2[i]!='\0'; i++)
if(str1[i]!=str2[i])
returnfalse;
if(str1[i]!='\0' || str2[i]!='\0')
returnfalse;
returntrue;
}
int main(int argc, char *argv[]) {
if(argc >= 3)
cout << is_equal(&argv[1], &argv[2]) << endl; // i have added (&) on both argvs.
return 0;
}
so when i try to use the gdb to find out the values of str1 and str2 it gives me a message saying that " No symbol "str1" in current context. "
and when i try to use my breakpoint on the function it gives me " rogram exited normally."
i know that the question may seem dumb, but can you please guide me?
¿can you post your session? I mean how you run gdb, what parameters you pass it, the commands that you execute and the output for each command.
Also, how you are building your code.
> No symbol "str1" in current context.
That may mean that you are not in the `is_equal()' function, so there is no `str1' variable, or that you didn't compile with debug information (-ggdb flag)
> when i try to use my breakpoint on the function it gives me "Program exited normally."
¿did you provide the arguments to the program?
Try to put the breakpoin in `main()' and step from there.