Answer:
see explaination
Explanation:
//Include required header file.
#include <stdio.h>
//Define the function isWordContainChar() having the
//required parameters.
int isWordContainChar(char* req_word, char search_char)
{
//Declare required variable.
int i;
//Start a for loop to traverse the string given in
//the function parameter.
for(i = 0; req_word[i] != '\0' ; i++)
{
//If the current character in the gievn word is
//matched with the character which needs to be
//found in the word, then return 1.
if(req_word[i] == search_char)
{
return 1;
}
}
//Otherwise, return 0.
return 0;
}
//Start the execution of the main() method.
int main(void)
{
//Declare the required variables.
int num_words, index, word_index;
char str_word[20][10];
char searchCharacter;
//Prompt the user to enter the number of words.
scanf("%d", &num_words);
//Prompt the user to enter the required words using a
//for loop and store them into an array.
for(index = 0; index < num_words; index++)
{
scanf("%s", str_word[index]);
}
//Prompt the user to enter a required character which
//needs to be found in a word.
scanf(" %c", &searchCharacter);
//Traverse the words stored in the array using a for
//loop.
for(index = 0; index < num_words; index++)
{
//Call the function isWordContainChar() with
//required arguments in rach iteration and if the
//value returned by this function is not 0, then
//display the current string in the array.
if(isWordContainChar(str_word[index],
searchCharacter) != 0)
{
printf("%s\n", str_word[index]);
}
}
return 0;
}