Possible Duplicate:
How to initialize an array in C
initializing an array of ints
I wonder over the fastest/simplest way to initialize an int array to only contain -1 values. The array I need is 90 ints long so the straightforward way should be to initialize it like this:
int array[90]={-1, -1, -1, ...};
but I only want to use the array once so I want to be able to use it dynamically and be able to free it after using it in the program, so Im more looking for a fast way like calloc
, but instead of zeros, -1 of course.