Bug: process terminated

I have a pop-up with an execution bug I'm using code::Blocks (Process terminated with status -1073741510)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int n_points = 10;
vector<double> phi ;

double update (vector<double> phi)
{
for (int x=1; x<n_points; x++) {
    phi[x]=x;
  }
  cout << "sa fonctionne";
}

int main ()
{
  double z;
  z = update(phi);
  cout << "The result is " << z;
}
  
Last edited on
valid index goes from 0 to size-1, is an error to access out of bounds.
your vector is empty, it has no elements.
Topic archived. No new replies allowed.