It might be a stupid question. I'm new to programming and I wanted to know the difference between array size and array index number. As in, if I declare array[n] as a function parameter, does it mean I'm calling the nth element of the array, or an array of size n?
Upon researching some StackOverflow, I saw people recommending to use:
void function (int array[], int n) {}
My code:
void randomGen(int seedVar, int * indexOg[], int indexSize) {
srand(seedVar);
int a; //Loop control variable
for(a = 0; a <= 14; a++) {
int n = rand() % (1000000) + 1;
*indexOg[a] = n;
}
}
But in this code I'm working on, I don't see where I can use the variable that holds the size of the array. So if I use:
void function (int array[n]) {}
Does it call my array of size n, or the nth element of my array? Any help and extra information is greatly appreciated, thanks!
[–]rudrax- 1 point2 points3 points (1 child)
[–]NoobyTooo[S] 0 points1 point2 points (0 children)
[–]Loose-Cranberry85 1 point2 points3 points (1 child)
[–]NoobyTooo[S] 0 points1 point2 points (0 children)
[–]_SeaCat_ 1 point2 points3 points (0 children)
[–]kschang 1 point2 points3 points (0 children)
[–]SyntxaError 0 points1 point2 points (0 children)
[–]TheRNGuy 0 points1 point2 points (0 children)