Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have malloced memory for a pointer array (char * ptrArray = (char*)malloc(sizeof(char) * rows * col). Using the fread function I read in a

I have malloced memory for a pointer array (char * ptrArray = (char*)malloc(sizeof(char) * rows * col). Using the fread function I read in a txt file and stored its grid of characters in ptrArray. I also malloced memory for another pointer array (char * wordsRead = (char *) malloc(sizeof(char) *rows * col). In this pointer array I used the fgets function to read and save a string of words into the wordsRead array.

What I need now is to create a basic program in C (NOT C++) that searches for words within the crozzword puzzle stored in the ptrArray pointer array using the words stored int the wordsRead pointer array.

Here is an example:

5 5 HEADH (the grid of characters stored in the ptrArray pointer array) ESEEB AHEAD DDAEH AYUDF head<------this word saved in wordsRead pointer array

Using the example above, the program created needs to find the word "head" in the crossword puzzle. The program should indicate where the word was first found using i and j coordinates along with the orientation of the word. For example, the grid above has the word "head" at i=0 and j=0 going East. Head is also found at i=3 and j=4 going west. Again, the instructions above are just an example. The txt file used can be a 10 x 10 or 1000 x 1000 grid. Words can be found up, down, left, right, and in both diagonal. Please include code that searches in directions mentioned.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions

Question

What are the stages of project management? Write it in items.

Answered: 1 week ago