Answers for "string array input in c"

C
0

create array of strings in c from user input

#include <stdio.h>

int main()
{
   char str[5][10];

   printf("enter the strings...n");
   for(int i =0; i < 5; i++)
   scanf("%s", str[i]);

   printf("All strings are...n");
   for(int j =0; j < 5; j++)
   printf("%sn", str[j]);
}
Posted by: Guest on April-29-2021
0

string array input in c

#include <stdio.h>
int main() {
    int i;
    char *word[3];
    for(i=0;i<3;i++)
    {
        printf(" Enter a word: ");
        scanf("%s", &word[i]);
    }
    printf("%s ", word[0]);
    return 0;
}
Posted by: Guest on January-18-2022

Code answers related to "C"

Browse Popular Code Answers by Language