Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with C Programming assignment
#7
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
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
Reply


Messages In This Thread
Need help with C Programming assignment - by Fiel - 2009-11-23, 09:18 PM
Need help with C Programming assignment - by Fiel - 2009-11-23, 09:22 PM
Need help with C Programming assignment - by Sivrat - 2009-11-24, 03:02 PM
Need help with C Programming assignment - by Fiel - 2009-11-25, 08:13 AM
Need help with C Programming assignment - by Fiel - 2009-11-25, 11:51 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)