im trying to create a program to reverse a string and if the string has uppercase i must change it to lowercase and vice versa but when i use scanf[^\n] it cant input anything. the input process only succeed in first input
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main() {
int ctr1, ctr2, loop1, loop2;
char char1[1010];
char upp[1010], low[1010];
int len;
scanf("%d", &loop1);
for (ctr1 = 0; ctr1 < loop1; ctr1++) {
scanf("%[^\n]", char1);
len = strlen(char1);
for(ctr2=0;ctr2<len;ctr2++){
upp[ctr2] = toupper(char1[ctr2]);
low[ctr2] = tolower(char1[ctr2]);
if (char1[ctr2] == low[ctr2]) {
char1[ctr2] = upp[ctr2];
}
else if (char1[ctr2] == upp[ctr2]) {
char1[ctr2] = low[ctr2];
}
}
printf("Case #%d: ", ctr1 + 1);
for (ctr2 = len - 1; ctr2 >= 0; ctr2--) {
printf("%c", char1[ctr2]);
}
printf("\n");
}
}