stack around variable' ' was corrupted

Hi i'm making a guessing game program and i've encountered this error of stack around variable ' ' was corrupted. I tried to replace the variable into others but still the same. So is there anyway to solve it?I only know how to use stdio.h so preferably solution using it. Here is my program:

#include <stdio.h>
#include <iostream>
void main()
{
char choice;
int num[4][4]={2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,2};
int i,k,row,col,x,y;
int Array[4][4];


printf("Welcome Player2 !");

printf("\n\n");

printf("**************************************************************************\n");
printf("GUESS THE TWO LOCATION OF A NUMBER GAME<guess the number behind the zero:>\n");
printf("**************************************************************************\n");


for(row=0;row<4;row++)
{
for(col=0;col<4;col++)
{
printf("%d\t",Array[4][4]=0);
}

printf("\n");
}


printf("\n\n");


printf("Which array would you like to open:<e.g: 1 1>: ");
scanf("%d%d",&i,&k);

system("cls");

for(row=0;row<4;row++)
{
for(col=0;col<4;col++)
{
if(row == i && col == k)
{
printf("%d\t",num[i][k]);
}

else
{
printf("%d\t",Array[4][4]=0);
}

}

printf("\n");
}

printf("Which 2nd array would you like to guess as a match: ");
scanf("%d%d",&x,&y);


if(num[x][y] == num[i][k])
{
for(row=0;row<4;row++)
{
for(col=0;col<4;col++)
{
if(row == x && col == y)
{
printf("%d\t",num[x][y]);
}

else if(row == i && col == k)
{
printf("%d\t",num[i][k]);
}

else
{
printf("%d%d\t",Array[4][4]=00);
}

}

printf("\n");
}

printf("You won!!!");
}




}

The words in bold is the error part of the program...
Last edited on
This statement

printf("%d\t",Array[4][4]=0);

is already invalid because there in no such element with indexes 4, 4 in the Array.
Topic archived. No new replies allowed.