I've been trying to fill up an array and then get the values back out later in the same method but can't get anything other than memory addresses (my debugging couts give 1.430294e-243ish numbers) for the life of me. If someone could let me know what I'm doing wrong I'd appreciate it very much. Here's my code setup:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
G4int numDets = 5; //or whatever
double Energydeposit[numDets]
int j = 0;
while ( j < numDets )
{
//some physics, which results in a double totalErot, different for each run through the loop
Energydeposit[j] = totalErot;
j++;
}
int k = 0;
while ( k < numDets )
{
if ( Energydeposit[k] != 0.0 )
{
cout << Energydeposit[k] << endl;
// the part of my code where I would use the values in Energydeposit[]
}
k++;
}
The cout always gives a memory address... I've tried using the dereferencing operator * like *Energydeposit[k], but when I do I always get an "invalid type argument of 'unary *'"
I don't think 1.430294e-243 is a memory address, it doesn't look like any I've seen. Make sure totalErot is what you expect it to be. I'd advise you print totalErot out before it's put in the array.