0xCoTiNe 0 Newbie Poster

I wrote a code which a crossword and a word are inputed and the cord of the beginning of the word are printed out and I keep getting the "Run-Time Check Failure #2" error at the very end.

#include <stdio.h>
#include <string.h>


int BottomBorCheck(int index);
int TopBorCheck(int index);

int main()
{
	char crossWord[10][10];
	char searchWord[80];
    int i, j, searchLoc = 0, iTopBor, iBotBor, jTopBor, jBotBor, iRightDir, jRightDir, wordCount, tempjBot, tempiBot;
	for(i=0;i<10;i++)
		for(j=0;j<10;j++)
			scanf("%s", &crossWord[i][j]);
    printf("Please enter the word to search\n");
    scanf("%s", &searchWord);
    wordCount = strlen(searchWord);
	for(i=0;i<10;i++)
        for(j=0;j<10;j++)
        {
            if((crossWord[i][j]==searchWord[searchLoc])||(crossWord[i][j]==(searchWord[searchLoc]-'A'+'a')))
			{
				//printf("[%d][%d]\n", i, j);
				searchLoc = 1;
				iTopBor = TopBorCheck(i);
				iBotBor = BottomBorCheck(i);
				jTopBor = TopBorCheck(j);
				jBotBor = BottomBorCheck(j);
				for(iBotBor;iBotBor<=iTopBor;iBotBor++)
					for(jBotBor = BottomBorCheck(j);jBotBor<=jTopBor;jBotBor++)
						if((crossWord[iBotBor][jBotBor]==searchWord[searchLoc])||(crossWord[iBotBor][jBotBor]==(searchWord[searchLoc]-'A'+'a')))
						{
							//printf("-[%d][%d]", iBotBor, jBotBor);
							iRightDir = iBotBor-i;
							jRightDir = jBotBor-j;
							tempjBot = jBotBor;
							tempiBot = iBotBor;
							searchLoc++;
							if((((tempiBot+iRightDir)>=0)&&((tempiBot+iRightDir)<=9))&&(((tempjBot+jRightDir)>=0)&&((tempjBot+jRightDir)<=9)))
								while(((crossWord[tempiBot+iRightDir][tempjBot+jRightDir]==searchWord[searchLoc])||(crossWord[tempiBot+iRightDir][tempjBot+jRightDir]==(searchWord[searchLoc]-'A'+'a')))&&(searchLoc<=wordCount))
								{
										searchLoc++;
										tempiBot = tempiBot+iRightDir;
										tempjBot = tempjBot+jRightDir;
								}
							if(searchLoc == wordCount)
								printf("[%d][%d]\n", i, j);
							searchLoc = 1;

						}
				searchLoc = 0;
				
			}


		}
    return 0;
}
int BottomBorCheck(int index)
{
	int newIndex;
	newIndex = index - 1;
	if((index - 1) < 0)
		newIndex = 0;
	return newIndex;
}

int TopBorCheck(int index)
{
	int newIndex;
	newIndex = index + 1;
	if((index + 1) > 9)
		newIndex = 9;
	return newIndex;
}

it's a bit of a mess.
this is the code.

sample input:

a b c o d e f g h i
j k l m l n o p q r
s t r z a l q w s x
c d e r f v e b g t
y h y u j m k h i l
o p p l o i k m j z
x c v b n m a s f g
h j k d q w r t y u
o p q z z b n h y a
r e k l j g h r s a

word: Hello

any ideas?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.