J
Jerry.Mouse
Guest
Hello I am getting C6011 on line
playingArea[x][y]->isMineHere = 0;
why ??? I have standard MS VS 2019, C++ console.
J.
// Mines.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
struct Cell {
int isMineHere;
char x;
char y;
int counterSurr;
} cell;
int main()
{
Cell* playingArea[10][10];
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
playingArea[x][y] = (Cell*) malloc(sizeof(Cell));
}// for
}// for
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
playingArea[x][y]->isMineHere = 0;
playingArea[x][y]->x = x;
playingArea[x][y]->y = y;
playingArea[x][y]->counterSurr = -1;
}// for
}// for
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
printf("%d", playingArea[x][y]->isMineHere);
}// for
printf("\n");
}// for
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
delete( playingArea[x][y] );
}// for
}// for
//std::cout << "Hello World!\n";
}// main
Continue reading...
playingArea[x][y]->isMineHere = 0;
why ??? I have standard MS VS 2019, C++ console.
J.
// Mines.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
struct Cell {
int isMineHere;
char x;
char y;
int counterSurr;
} cell;
int main()
{
Cell* playingArea[10][10];
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
playingArea[x][y] = (Cell*) malloc(sizeof(Cell));
}// for
}// for
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
playingArea[x][y]->isMineHere = 0;
playingArea[x][y]->x = x;
playingArea[x][y]->y = y;
playingArea[x][y]->counterSurr = -1;
}// for
}// for
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
printf("%d", playingArea[x][y]->isMineHere);
}// for
printf("\n");
}// for
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
delete( playingArea[x][y] );
}// for
}// for
//std::cout << "Hello World!\n";
}// main
Continue reading...