dimanche 28 juin 2015

Take sentence from user input with C

I wana take input from user and then print, I think I should also allocate memory could someone show me how to do that properly?

Here is my try:

    int days = 1;
    char * obligation[1500];
    char * dodatno[1500];

    puts("Enter nuber of days till obligation:\n");
    scanf(" %d", &days);
    puts("Enter obligation:\n");
    scanf(" %s", obligation);
    puts("Sati:\n");
    scanf(" %s", dodatno);

printf("%s|%s|%s \n",days,obligation,dodatno);

Aucun commentaire:

Enregistrer un commentaire