I am working on A tree search funtion. Currently I am just trying to see whether its working or not. Like I have added data in root node and now i am comparing it with the input. But the If condition of program higlighted below doesnt work.
Code:
void treeSearch(char a[24])
{
Node* temp;
temp = root;
bool flag = false;
char pointer[24];
strcpy(pointer,a);
for (int i = 0; i < 24; i++)
cout<<pointer[i];
//check to check the root
for (int i = 0; i < 24; i++ )
{
if (strcmp(temp->data,pointer) == 0) {
cout<<"Found";
flag = true;
return;
}
}
if (flag == true)
cout<<"FOUND";
return;