cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
UNIX/Linux Programming
Segmentation fault (core dumped)
Segmentation fault (core dumped)
Jan 26, 2014 at 9:18pm UTC
Legend33
(5)
void goster(int x,int y){
string yilan[20][20];
for(int a=0;a<=20;a++){
yilan[0][a]="a";
}
for(int k=1;k<=19;k++){
for(int l=0;l<=20;l++){
if(l==0 || l==20){
yilan[k][l]="a";
}
else{
yilan[k][l]=" ";
}
}
}
for(int t=0;t<=20;t++){
yilan[20][t]="a";
}
for(int b=0;b<=20;b++){
for(int i=0;i<=20;i++){
cout<<yilan[b][i];
}
}
};
This is my function.I write it.But When I'm trying to run it shows "Segmentation fault (core dumped)" on linux command screen.Why it happens?Thanks for yours helps
Jan 26, 2014 at 9:50pm UTC
ne555
(10692)
http://www.cplusplus.com/forum/general/112111/
1
2
3
4
string yilan[20][20];
for
(
int
a=0;a<=20;a++){ yilan[0][a]=
"a"
; }
out of bounds
Jan 27, 2014 at 10:28am UTC
Legend33
(5)
Thanks, you are right
Topic archived. No new replies allowed.