Hi...this is the code that I wrote to find a particular string from a 2-d array of characters. It prints F(for found) and N(for Not found).
When I execute this program, it prints N only.
#include<iostream.h>
#include<conio.h>
char SearchString(char[5][10],char[10]);
void main()
{
clrscr();
char str1[5][10],str2[10];
int i;
cout<<"\nEnter 5 objects:-";
for(i=0;i<=4;i++)
cin>>str1[i];
cout<<"\nEnter the string to be searched:-";
cin>>str2;
cout<<"\n\n\n"<<SearchString(str1,str2);
getch();
}
char SearchString(char str1[5][10],char str2[10])
{
int i;
for(i=0;i<=4;i++)
{
if(str1[i]==str2)
return('F');
}
return('N');
}