I have this piece of code:
placeword(char *wordpointer,char puzzlespace[60][60],int dumbarray[2])
{
int length=0,i=0,q=0,xandyarray[2];
while(word[length]!=0)
{
length++;
}
//This is the for loop in question
for(i=0;i>100;i++)
{
int randomx=(rand()%(dumbarray[0]+1)),randomy=(rand()%(dumbarray[1]+1));
xandyarray[0]=randomx;
xandyarray[1]=randomy;
int a=checkhoriz(word,puzzlespace,xandyarray),b=checkvert(word,puzzlespace,xandyarray);
if((puzzlespace[randomx][randomy]==BLANK)&&((randomx+length)<=dumbarray[0])&&(a==1))
puzzlespace[randomx][randomy]=puts(word);
if((puzzlespace[randomx][randomy]==BLANK)&&((randomy+length)<=dumbarray[1])&&(b==1))
{
for(q=0;word[q]==0;q++)
{
puzzlespace[randomx][randomy+q]=word[q];
}
}
return;
}
}
It is rather simple, but the For loop is skipped during testing. I ran it step by step, and the program reaches the loop and skips to two lines past the return;. I don't know what is causing this. i=0, and the other For loops in my program work, just not this one.
placeword(char *wordpointer,char puzzlespace[60][60],int dumbarray[2])
{
int length=0,i=0,q=0,xandyarray[2];
while(word[length]!=0)
{
length++;
}
//This is the for loop in question
for(i=0;i>100;i++)
{
int randomx=(rand()%(dumbarray[0]+1)),randomy=(rand()%(dumbarray[1]+1));
xandyarray[0]=randomx;
xandyarray[1]=randomy;
int a=checkhoriz(word,puzzlespace,xandyarray),b=checkvert(word,puzzlespace,xandyarray);
if((puzzlespace[randomx][randomy]==BLANK)&&((randomx+length)<=dumbarray[0])&&(a==1))
puzzlespace[randomx][randomy]=puts(word);
if((puzzlespace[randomx][randomy]==BLANK)&&((randomy+length)<=dumbarray[1])&&(b==1))
{
for(q=0;word[q]==0;q++)
{
puzzlespace[randomx][randomy+q]=word[q];
}
}
return;
}
}
It is rather simple, but the For loop is skipped during testing. I ran it step by step, and the program reaches the loop and skips to two lines past the return;. I don't know what is causing this. i=0, and the other For loops in my program work, just not this one.