Answers for "how to input multiple strings in c"

0

how to input multiple strings in c

#include<stdio.h>
int main()
{
int n,i;
char str[20][20]; // Can store 20 strings, each of length 20

scanf("%d",&n); //how many string

//input each string
for(i=0;i<n;i++)
{
   scanf("%s",str[i]);
}

//display each string
for(i=0;i<n;i++)
{
   printf("%s",str[i]);
   printf("\n");
}

return 0;
}
Posted by: Guest on June-22-2021

Code answers related to "how to input multiple strings in c"

Browse Popular Code Answers by Language