#include <stdio.h>
char str[5][10]={"asdasdasd", "", "", "qweqweqwe", "asdasdasd"};
int main (){
change (4, 5, 3, 2);
}
void change (int r1, int c1, int r2, int c2){
int i=0;
for (i=0; i<2; i++){
str[r2][c2+i] = str[r1][c1+i];
}
for (i=0; i<2; i++){
str[r1][c1+i] = ' ';
}
return;
}
str is a 2-d string.
when I debug it, the second for loop just Works and deletes those characters, but the first row doesnt work. why?
the error is, when I print the string, the chars at [r1][c1] and [r1][c1+1] is deleted but [r2][c2] and [r2][c2+1] is still empty.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…