I want to initialize some elements in an array at the beginning(say 300 elements) and at the ending(230 elements) to 0 and the elements between start and end to a value based on the calculation. Currently, I am doing in the following way:
Expand|Select|Wrap|Line Numbers
- float fArray[2000];
- int i;
- for( i = 0; i < 300; i++)
- {
- fArray[i] = 0.0;
- }
- for(i = 300; i < 1770; i++)
- {
- //Setting fArray[i] based on some calculation
- }
- for(i = 1770; i < 2000; i++)
- {
- fArray[i] = 0.0;
- }