How do you decalare an array of an unknown value.
basicly i needa scan a file with a bunch of numbers in them and store em into an array. but i dont know how many numbers will be in the file could be 3 5 7 200,000 .
How do you decalare an array of an unknown value.
basicly i needa scan a file with a bunch of numbers in them and store em into an array. but i dont know how many numbers will be in the file could be 3 5 7 200,000 .
Code:int *array; array = malloc(number_of_elements * sizeof(int)); if (NULL == array) { printf("Failure to allocate memory for %d elements\n", number_of_elements); exit(0); }