What am I doing wrong in coding this 2D arrays program? I get 2 errors and do not know how to solve the issue... I get "error C2061: syntax error : identifier 'letter'" and "error C2065: 'array' : undeclared identifier"
Code:
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
int _tmain(int argc, _TCHAR* argv[])
{
int col, row, x, y, width, height, stop=0, letter=3;
do
{
printf("Enter x0, y0, width, height:");
if(scanf_s("%i%i%i%i",&x,&y,&width,&height)==EOF)
{
stop=1;
}
else
{
printf("0000000000111111111122222222223333333333\n");
printf("0123456789012345678901234567890123456789");
for(row=0;row<x;row++)
{
if (row<10)
{
printf("0%d", row);
printf("\n");
}
else
{
printf("0%d", row);
printf("\n");
}
}
for(col=0;col<40;col++)
{
if((col==x)||(col==(x+width-1))||((row==y)||(row==(y+height-1))))
if((col>=x)&&(col<=(x+width-1))&&((row>=y)&&(row<=(y=height-1))))
{
array[row][col]=letter;
}
}
}
printf("%c",array[row][col]);
printf("\n");
}
letter++;
while(!stop);
for(;;);
return 0;
}