C array problem
The number of array elements can't be variable, so you can only define a larger array to solve it at first. After learning pointer, it can be realized by dynamic array, and the memory can be directly operated by pointer.

It seems like this:

1. Define a pointer (take an integer one-dimensional array as an example)

int * p;

2. Enter the number of digits

scanf("%d ",& ampn);

3. Allocate memory for pointers

p =(int *)malloc(n * sizeof(int));

compare

Here, for example, call the i-th element, and that's it.

*(p+i)

In addition, you can also use linked lists. Regarding the linked list, first define a structure, including an integer variable and a pointer, which is used to point to the next structure of the same type. I won't say much about the method, and I am interested in finding relevant knowledge myself.