Writing functions with arrays.

Hi!

I wonder what the double V[] stands for. And also why do i write double X[size].
What i can see is that i call the function enter_seq and there i have a array which can store 10 numbers int f. but what does double V[] do.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

int enter_seq(double V[], int f)
{
    for (int i = 0; i < f; i++)
    {
        cin >> V[i];
        cout << V[i] << endl;
    }

}


int main()
{
    const int size = 100;
    double X[size];

    cout << "Enter sequence: ";
    enter_seq(X, 10);



}
You shall write programs youself. In this case there are not foolish questions.
What?
closed account (zb0S216C)
Schlibib wrote:
double V[]

...is equivalent to: double *V. When you pass an array to it, it points to the first element of the passed array. I guess you can say it's used to explicitly state that you want an array to be passed.

Wazzak
Topic archived. No new replies allowed.