struct data_struct* search_in_list(char *val, struct data_struct **prev)
{
char *dat=NULL;
char *dat2=NULL;
struct data_struct *ptr = head;
struct data_struct *tmp = NULL;
bool found = false;
printf("\n Searching the list for value [%s] ...found is.%d\n",val,found);
while(ptr != NULL)
{
printf("\n ptr !=null .....Searching the list for value ");
dat = ptr->val;
dat2 = val;
printf("hello world %s.......%s",dat,dat2);
**if (dat == dat2)
printf("Hello !!!");**
found = ( val == ptr->val);
printf("the data is%d",found);
if (found)
{
printf("\n ptr val if......Searching the list for value [%s] ",ptr->val);
found = true;
break;
}
else
{
printf("\n else found....Searching the list for value [%s] ",ptr->val);
tmp = ptr;
ptr = ptr->next;
}
}
if(true == found)
{
ptr = ptr->next;
printf("\n truefound...Searching the list for value [%s] ",ptr->val);
if(prev)
*prev = tmp;
return ptr;
}
else
{
printf("\n Searching the list for value [%s] ",ptr->val);
return NULL;
}
}
strong text................................................................................
``In above code condition : if (dat == dat2)
printf("Hello !!!");
Above condition is not working. Any idea why. If I compare ("serverip" == "serverip") this works ok..
but if i say ( ptr->val == val) ..... this doesnot work... dunno why. am i doing something wrong... any guesss....
Aucun commentaire:
Enregistrer un commentaire