Segmentation fault (core dumped)

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
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
Thanks, you are right
Topic archived. No new replies allowed.