I’m trying to replace the first line with spaces, what is it that is wrong here?
#include <stdio.h>
int main(void){
char text[5][10]={
{'a','a','a','a','a','a','a','a','a','\0'},
{'a','a','a','a','a','a','a','a','a','\0'},
{'a','a','a','a','a','a','a','a','a','\0'},
{'a','a','a','a','a','a','a','a','a','\0'},
{'a','a','a','a','a','a','a','a','a','\0'},
};
for (int i=0;i<10;i++){
text[i]=' ';
}
for (int i=0;i<5;i++){
printf("%s\n",text[i]);
}
return 0;
}
I’d go one further – you’re overwriting the null at the end of the first ‘line’. Set your loop to iterate over 0..9: