Hello to you all ,
I have been assigned to in C to build a function which will take 2 strings and count (in recursive way) how many chars are alike (case sensitive).
I have setup the main and also a function which recieves the input from user .
I have a problem converting the theory to commands :
if the function recieves 2 strings , the comparison needs to letter to letter with the same index , and adding 1 to the returned value if they are equal, in which the advance down the recursive process is "index+1".
I tried it , but it doesnt work and i have no idea howcome .
Code :
int func(char s1[], char s2[])
{
int i=0;
if (s1!=s2) return 0;
if (s1==s2) return 1+func(s1[i+1],s2[i+1]);
}
am i missing something ?
thank you
Yotam :D