I have to make a program in c that accepts one word with no spaces and prints out each letter on a new line. However, I have to use fgets. I wrote this program:
#include <stdio.h>
#define MAX_LINE 4096
int main(void) {
    int i;
    char array[MAX_LINE];
    printf("Enter a string: ");
    fgets(array,MAX_LINE,stdin);
        for(i=0; array[i]!='\0'; i++){  
            printf("%c\n",array[i]);
       }
       return 0;
}
But it keeps printing out an extra 2 lines at the end of the word. I don't understand why.
 
     
    