Can you define the size of an array at runtime in C
New to C, thanks a lot for help. Is it possible to define an array in C without either specifying its size or initializing it. For example, can I prompt a user to enter numbers and store them in an int array ? I won't know how many numbers they will enter beforehand. The only way I can think of now is to define a max size, which is not an ideal solution... Well, you can dynamically allocate the size: #include <stdio.h> int main(int argc, char *argv[]) { int *array; int cnt; int i; /* In the real world, you should do a lot more error checking than this */ printf("enter the amount\n"); scanf("%d