Originally Posted by
CProgramming11
Funny enough, returning 0 also returns that 420...value. By this I mean i run the original code I posted and the run screen will show 'Process returned 4206592'.
I think that you are confusing the return value of the function with the exit status of the program (process).
I suggest that you compile and run this program, which is a cleaned up version of what you posted originally:
Code:
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
bool foo(const char *a, const char *b)
{
size_t i, j, len_a = strlen(a), len_b = strlen(b);
for (i = 0; i < len_a; i++)
{
for (j = 0; j < len_b; j++)
{
if (a[i] == b[j])
return false;
}
}
return true;
}
int main(void)
{
const char *string1 = "ABCD";
const char *string2 = "DEFGH";
printf("%d\n", foo(string1, string2));
return 0;
}
Is the output 0? If so, there is no problem.