I need a function.This function has two arguments.Both of them are strings.This function must do this:
if str1=asdfgh
and str2=alksh
then the function must print a string with the characters of str1 that not include characters from str2 so str3=(a)(s)dfg(h) but a,s,h are also characters from str2 and we don't print them
MY THOUGHT:PHP Code:str1=asdfgh
str2=alksh
str3=dfg
note: A)the function finally must print reversely the new string (so str3 = gfd and not dfg)but i begin with the simple case and i belive that after i will can do it and reverslyCode:#include <stdio.h> void myfunc(char str1[], char str2[]); int main(void) { char str1[]="hello"; char str2[]="hallo"; myfunc(str1[],str2[]); return 0; } void myfunc(char str1[], char str2[]) { int i; for(i=0; str1[i]; i++) { if(!(str1[i]==str2[i])) printf("%s", str1[i]); /*must print only e*/ } }
B)we also can use pointers
compile error :func.c:10: error: expected expression before ‘]’ token
Any idea? hint? Pease help!



LinkBack URL
About LinkBacks




)