2009-11-24, 03:02 PM
ok i'm pretty sure i got the code written for the substring and subsequence done, but am somewhat unsure of how to do the permutation fully. This is what i have so far
the thing is i cant figure out where/how to phrase the return true statement. Also, since i havent tried it i may as well check, would the break statement exit out of both loops? or only the one?
and is string1[i] really a boolean expression to denote when its not null? or do i have to say like string[i] != '\0' ?
here are the other functions i had, if you care to double check. I havent debugged them yet.
substring
subsequence
Code:
int permutation(char string1[], char string2[]);
{
int i, j;
for(i=0; string1[i]; i++;) {
for(j=0; string2[j]; j++;) {
if (string1[i] == string2[j])
break;
if (string[j] == '\0')
return false;
}
}the thing is i cant figure out where/how to phrase the return true statement. Also, since i havent tried it i may as well check, would the break statement exit out of both loops? or only the one?
and is string1[i] really a boolean expression to denote when its not null? or do i have to say like string[i] != '\0' ?
here are the other functions i had, if you care to double check. I havent debugged them yet.
substring
Spoiler
subsequence
Spoiler

