Store string into array in c
arrays, c
Solution
You need a 2 dimensional character array to have an array of strings:
#include <stdio.h>
int main()
{
char strings[3][256];
scanf("%s %s %s", strings[0], strings[1], strings[2]);
printf("%s\n%s\n%s\n", strings[0], strings[1], strings[2]);
}
Problem
As i know, i can create an array with item inside such as: ``` char *test1[3]= {"arrtest","ao", "123"}; ``` but how can i store my input into array like code above because i only can code it as ``` input[10]; scanf("%s",&input) or gets(input); ``` and it store each char into each space. How can i store the input "HELLO" such that it stores into input[0] but now H to input[0],E to input[1], and so on.