2
Code:
#include <stdio.h>
#include <string.h>
int main() {
int i, j, k;
char nomes[10][99];
for (j = 0; j < 2; j++) {
printf("\nTurma %d:\n", j+1);
for (i = 0; i < 10; i++) {
printf("Aluno: ");
scanf("%s", &nomes[i][j]);
}
}
printf("\nTurma 1:\tTurma 2:\n");
for (i = 0; i < 10; i++) {
for (j = 0; j < 2; j++) {
printf("%s\t", &nomes[i][j]);
}
printf("\n");
}
}
The output of the second column is perfect (as far as possible), but the first column prints only the first letter of the string and concatenates with the respective string of the second column. I do not understand why this happens, I wanted to know what part of the code causes this problem. I will link an input image and an output image of the program to make everything clearer.
Thank you so much for the answer! I am new in C and do not know much, helped me too :).
– Lucas Henrique