ok well i am close, but i am still not getting the 0's in the appropriate positions of my array. here is the code i used..
Code:
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
void zeros( int x[], int n)
{
int i;
for( i = 0; i < n; ++i)
{
x[i] = -10 + 21*(rand()/(RAND_MAX+1.0));
}
while((i >= 20) && (i < 25))
{
int i;
x[i] = 0;
}
}
void print( int x[], int n)
{
int i;
for( i = 0; i < n; ++i)
printf( " %i", x[i]);
putchar( '\n');
}
#define N 30
int main( void)
{
int y[N];
zeros(y,N);
print(y,N);
return 0;
}
can anyone tell me what i did wrong?