value of the variable "historyLength" keeps changing

All the variables used are declared in predictor.h.
When i execute this code(I didn't mention the whole code) the first time I print the value of 'historyLength' variable iam getting the correct value. But when Iam printing it in places labelled as 'one' and 'two' iam getting the value as 0.
Anybody please tell me why this is happening ?
Thanks in advance.

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
#include "predictor.h"
#include "math.h"
#include "vector"
#include "iostream"
#define H 12
#define tablesize 1024  
PREDICTOR::PREDICTOR(void){

historyLength = H;
cout<<"h"<<historyLength<<endl;     // correct
theta = (1.93 * historyLength + 14);

weightlength =( 1 + (log(theta)/ log(2)));

for(UINT32 ii=0; ii< historyLength; ii++){
 ghr [ii]= 0 ;
}

cout<<"h"<<historyLength<<endl;                     //one
for(UINT32 ii=0;ii<historyLength;ii++){
weights[ii]= 0;
}

cout<<"h"<<historyLength<<endl;                    //two
.
.
.
   
Topic archived. No new replies allowed.