I am new to c programming and would like to write a program which has the following requirement:
Input: The number of inputs n, then n input chars , for example, 3 welcome to hku
Output concatenated chars, for example, welcomehku
However, I discovered a problem that when I submit the codes as following to the c autochecking platform, the output is ~~~~welcometohku instead of welcometohku.
Would anyone like to give help on the issue? Thank you very much to all of you.
#include<stdio.h>
#include<string.h>
int main(){
    int num;  /* array with 50 elements */
    int i = 0;
    char iarray1[100];
    /* read array */
    scanf("%d", &num);
    char iarray[num][100];
    for (i = 0; i < num; i++) {
        scanf("%s", iarray[i]);
    }   
    /* print array elements in reverse order */
    for (i = 0; i < num; i++) {
        strcat(iarray1,iarray[i]);
    }
    //display the concatenated string
    printf("%s",iarray1);
    return 0;
}
 
    