in Programming in C
447 views
0 votes
0 votes

bool foo(char *s)

{ char c[ ]=”correspondence”;

int i=0,j=0;

While(s[i] && c[j])

{ if (s[i] ==c[j]) j++;

i++;

}

if(! c[j]) return true;

else return false;

}

The string ‘response’ and ‘credence' are passed to the above function too one by one and output is observed in each case. book data type return true or false

 

in Programming in C
447 views

1 Answer

0 votes
0 votes
False,False

4 Comments

yes, i am also getting false,false
0
0
I'm also getting F,F
0
0
if the code was like:

if(s[i] == c[j]) i++;

     j++;

then True, True is correct

It is checking if the supplied input is substring of the given string "correspondence".
0
0