I am doing this programming problem where I have reverse string of about 30 characters for 10 test cases.

My code is this:-

```
#include <stdio.h>
#include <string.h>

int main () {

    int t;
    scanf("%d",&t);

    while (t--) {
        char str[30];

        scanf("%s",&str);

        char revStr[30];

        int len = strlen(str);
        int i = 0;
        int j = len-1;

        while (i < len) {
            revStr[i] = str[j];
            i++; j--;
        }

        printf("%s\n",revStr);
    }

    return 0;
}

```

The output gets garbled up if the input string is larger than previous string.

For example,

if `last-string` had `6` characters, like `rocket\0` and `new-string`, which is `fun\0` has `3` characters, the output is `funket\0`.