Split string from a character array?

Hello!
Help to realize the following thing:
1. User-entered numbers, such as 1 3 50
2. Need to i[0] = 1, i[1] = 3, i[2] = 50,

How to implement this in c?
You can use printf / scanf for I / o
June 10th 19 at 15:26
1 answer
June 10th 19 at 15:28
In that case, if there are three numbers, otherwise the desired cycle and Dean.array.
#include <stdio.h>

#define SIZE 3

int main(void) {
 int i[SIZE];

 scanf("%d%d%d", &i[0], &i[1], &i[2]);
}</stdio.h>
But if the number of characters entered directly into a string?
That is, first comes the number of numbers, then these numbers: 3 1 2 3 - eveline.Stamm19 commented on June 10th 19 at 15:31
Here is an example of one of the implementations.
#include <stdio.h>
#include <stdlib.h>

int main(void) {
 int i;
 int *num;
 int size;

 scanf("%d", &size);
 num = malloc(sizeof(int) * size);
 for(i = 0; i < size; i++)
 scanf("%d", &num[i]);
}</stdlib.h></stdio.h>
- ara_Spencer18 commented on June 10th 19 at 15:34

Find more questions by tags C