Created
June 29, 2017 11:26
-
-
Save k1mny/c70a5c2c700f992b3cd8a5fb084aa8cd to your computer and use it in GitHub Desktop.
C++でSegmentation fault: 11とBus error: 10が出てしまうときの一例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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