I need to make a program in C that takes a sequence of numbers, stores the values in a vector, and then prints that sequence in reverse order. It must receive two entries, the first is an integer that indicates how many numbers the sequence has, and the second is the sequence of numbers (each number is separated by a 'space only'), as in the example:
4
2 51 8 10
To read the string I thought about using the function:
char sequencia[100];
scanf("%[^\n]",sequencia);
But I'm not able to separate the values and store them inside a vector of integers. How can I resolve this problem?