Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
C++でSegmentation fault: 11とBus error: 10が出てしまうときの一例
#include <iostream>
using namespace std;
int A[10][10];
int main() {
memset(A,0,sizeof(A));
//Bus error
for(int i=0; i<10; i++) {
for(int j=0; j<10; i++) {
cout << A[i][j] << " ";
}
cout << endl;
}
}
#include <iostream>
using namespace std;
int main() {
int A[10][10];
memset(A,0,sizeof(A));
//Segmentation fault
for(int i=0; i<10; i++) {
for(int j=0; j<10; i++) {
cout << A[i][j] << " ";
}
cout << endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment