I need to dynamically allocate an array of type int
with size 12MB. I did it as follows:
unsigned int *memory;
memory = (int *) malloc( 3072 * sizeof(int));
How would I iterate through the array without having to use 3072
? Is there a way to get the length of the array? Or should I just do for (int i = 0; i < 3072; i++)
?
Thanks