sao biến a của trong bài em bị thay đổi giá trị vậy mn.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
void ten(char c[]) {
int j;
printf("%c", c[0] - 32);
for (j = 1; j < strlen(c); j++) {
if (c[j] == ' ') {
printf(" %c", c[j+1] - 32);
j++;
}
else printf("%c", c[j]);
}
}
int main() {
int i;
int a;
int t = 0;
printf("Nhap so nguoi: "); scanf("%d", &a);
char c[a][30];
gets(c);
for (i = 1; i <= a; i++) {
printf("%d", a);
printf("Nhap ho ten cho nguoi thu %d: ", i); gets(c[i]);
}
for (i = 1; i <= a; i++) {
printf("Ten nguoi thu %d: ", i);
ten(c[i]);
printf("\n");
}
return 0;
}