How to declare and instantiate a Double vector?

0

I'm trying to fill a vector of Double with 1's, but I'm not sure how to declare and instantiate the variable.

double betaParcial[] = null;

// 'linha' seria o tamanho do vetor, e pode assumir qualquer numero (ex.: 3 ou 4)
for(int i=0 ; i<linha; i++) { 
    betaParcial[i] = 1.0; // Ocorre o erro
}
    
asked by anonymous 01.10.2017 / 19:04

1 answer

3

Try:

double betaParcial[] = new double[linha];
    
01.10.2017 / 19:06