Home > Software engineering >  scanf problem when adding multiple strings
scanf problem when adding multiple strings

Time:10-17

So I have a code, which gets in input arbitrary number of lines of arbitrary length. Each line generally contains one or more words separated by whitespace. I have to output that strings.

So this my code. I am newbie in C, and don't be so rude for my dumb-code ;)

#include <stdio.h>
#include <stdlib.h>

int main () {
    int i = 1;
    char **list = malloc(1000 * sizeof(char*));
    while(!feof(stdin)){
        list[i] = malloc(1000 * sizeof(char));
        printf("Enter string with num %d: ", i);
        scanf("           
  • Related