Hi, I am trying to search for a word I have entered into a list. I could list all entries so far. But I am having a hard time figuring out a function that can search for a particular word on the list. Below are the codes. I commented out different functions I have tried. Thank you!

boolean searchWord (VOCAB V[])

  {
         int i;
         char target[LENGTH];
        
         
             printf("\nEnter the Word you want to search: "); 
             fflush (stdin);
             gets (target);  
             
            for ( i=0; i<SIZE; i++) 
             {
            // if ( target == V[i].Word )
             //if ( strcmp( target, V[i].Word ) == 0);
             
              
              if (strncmp (V[i].Word,"target") == 0)

                 {
                  return 0;
                  }             
                 return 1;    
           }
     }

Edited 7 Years Ago by Nick Evan: Added code-tags

line 18: use the commented statement at line #15.
remove the semicolon at its end.
line #21: u are returning 0 on success. (0 is generally used as false)

line 18: use the commented statement at line #15.
remove the semicolon at its end.
line #21: u are returning 0 on success. (0 is generally used as false)

[TEX]Thank you dkalita! And Have a nice Christmas![/TEX]

This question has already been answered. Start a new discussion instead.