السلام عليكم ورحمة الله وبركاته
اريد ان اعمل برنامج
write program that has two string .the programe has function to search about string 2 in the string 1
your programe should return the addres of first match if no match exist return null
#include <iostream.h>
#include<stdio.h>
char[] stringCompare(char[],char[]);
int main(){
char str1[100],str2[100];
char compare [100];
printf("Enter first string: ");
scanf("%s",str1);
printf("Enter second string: ");
scanf("%s",str2);
compare = stringCompare(str1,str2);
return 0;
}
char[] stringCompare(char str1[],char str2[]){
char match[100];
// while(str1!='\0' && str2!='\0'){
for(int i=0;i<100;i++) {
for(int j=0;j<100;j++){
if(str1==str2[j]){
match=str1;
}
if(str1!=str2){
break;
}
}
}
cout<<match;
return match;
}ولكن يحتوي على اخطاء لا اعرف سببها ولا يظهر النتيجة ك المطلوب
انا مبتدئة جدا في السي هل لكم مساعدتي


