daisy i
2014-02-24 23:39:22 UTC
I can't seem to get it right.
Here is my main:
int main()
{
int Array[50],
*p1;
return 0;
}
function prototype:
void fillArray ( int Array[], int *p )
{
srand( time(0) );
for (int i = 0; i < 10; i++) // less than 10 because only 10 filled???
{
for ( int j = 0; j < i; j++) //within previous loop
{
p[i] = rand() % 11;
p++; // moving to next location, not sure if this is right.
}
}
}
I have a hard time with pointers because I just learned them. It displays random numbers in all 50 elements. I know I'm doing something wrong with the pointers. Any help is appreciated, thank you!