c++ - 0x7A47E727 中未处理的异常
问题描述
#include "pch.h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
//system("cls");
const int x = 30;
const int y = 15;
string tabella[y][x];
char bordo = '#';
for (int i = 0; i < x; i++)
tabella[0][i] = bordo;
for (int i = 0; i < y; i++)
tabella[i][0] = bordo;
for (int i = 0; i < x; i++)
{
for (int j = 0; j < y; j++)
{
std::cout << tabella[i][j];
}
std::cout << "\n";
}
}
我不知道为什么它给了我这个问题:
Eccezione non gestita in 0x7A47E727 (ucrtbased.dll) in Prova1.exe: 0xC0000005: violazione di accesso durante la lettura del percorso 0xCCCCCCCC。
这里是英文翻译:
Test1.exe 中 0x7A47E727 (ucrtbased.dll) 中的未处理异常:0xC0000005:读取路径 0xCCCCCCCC 时访问冲突。
问题似乎出在这一行:
std::cout << tabella[i][j];
我不知道,但它是在我使用 xey 变量时开始的。我正在使用 Visual Studio 2017 顺便说一句。
解决方案
看看你的数组边界。你有i
和j
错误的方式。
std::cout << tabella[i][j];
应该
std::cout << tabella[j][i];
或者,也许你一开始就x
走错y
了路。
推荐阅读
- java - 杰克逊的“轻松”字段名称
- reactjs - 使用 webpack-dev-middleware 和 webpack-hot-middleware 的 react-error-overlay 不起作用
- authentication - 使用多个 ServiceStack 的身份验证提供程序会引发错误
- amazon-web-services - AWS - 如何将 DynamoDb 表数据传递给 Lambda 函数
- design-patterns - 如何设计一个发布订阅系统,其中同一实体可以有多个发布者?
- matlab - matlab中“内存不足”错误的解决方法
- selenium-webdriver - 从渲染器接收消息超时:9.999,截屏时
- python - 神经网络首先找到最佳超参数或架构
- tensorflow - AttributeError:模块“tensorflow.estimator”没有属性“SessionRunHook”
- xml - 命名空间问题