Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Aghhh vectors

  1. Oct 8, 2006 #1
    Ok, I'm trying this code in Dev-C++

    int main(int argc, char **argv)
    {
    double **a;
    double *b;
    // double *m;
    int n, iter;
    double tol;

    b = new double[n];

    a = new double*[n];
    for (int i = 0; i < n + 1; i++)
    a = new double[n];

    // m = new double[n];

    cout << "I'm ready to continue =)!!!";

    system("PAUSE");
    return 0;
    }

    If I omit the m vector, the program will run and not disappear in a second and it will be ready to continue.. but when I declare the m vector without even doing anything with it... it just runs and quits quicker than I can blink my eye...! Why is this happening =(?
     
  2. jcsd
  3. Oct 8, 2006 #2
    Forget this post, I just realized I had to initialize n before doing any of this ... tehe =)
     
  4. Oct 8, 2006 #3
    n is undefined.

    Edit: Sorry, just saw your follow up.
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook




Loading...
Similar Threads for Aghhh vectors Date
Is it all in the angle? Jan 3, 2018
Perceptron algorithm initial vector Dec 28, 2017
Fortran Matrix times vector in Fortran Jul 28, 2017
C/++/# Arrays/vectors without knowing type Jun 19, 2017