Need help in find the values

Hi All ,

We are having a function like this . Can anyone help me in the output of DATA and the explanation of ADiv function. Thanks for your help in advance.

// token = 99.904046
  int rec = atol(token);
  Data=atof(token)/ADiv[rec]; break;

token values = 99.904046

and ADiv is in .h files as

const unsigned long ADiv[] = {
		1L, 
		10L, 
		100L, 
		1000L, 
		10000L, 
		100000L, 
		1000000L, 
		10000000L, 
		100000000L, 
		1000000000L		
	};

No. You do not have a function. (Or at least you have not shown us a function.) You have shown us a declaration for an array of 10 unsigned long integer values (assuming we are looking at C or C++ code), you have shown us a comment (assuming we are looking at C++ or recent C code), you have implied that a character pointer named token has been set to point to the string "99.904046" (but you have not shown us any code that does that), you have shown us that you convert that string into a signed long integer value and assign the result to a signed integer named rec (assuming that you have correctly declared atol() or included the standard header in which it is declared), and you then assign an element of an undeclared array Data[] at an index in the array specified by another undeclared variable ( i ) to the division of the string mentioned earlier being converted to a floating point value (assuming that atof() has been declared correctly or that you have included the standard header in which that function is declared) by the 100th element of the 10 element array ADiv[] (which could by a division by a random value or a reference to an unallocated memory position yielding a random value or termination of your code with a memory fault).

ADiv is an array containing ten elements. In order for ADiv[rec] to access the value within the boundary of the array, the return of atol(token) must be the equivalent to an index between 0 and 9, inclusive, which it will not happen with the supposedly const char *token = "99.904046";

Here is the code. when I debugged I get token value as 99.904046 (this is the first token values we have lots of token value which we will get in getnext token function)

		int dPrec = atol(token);

		for (i=0; i < (SHORT)nTagCounts[nDim]; i++) {
			TS->GetNextToken(token);
			
			if (!strlen(token)) {
				pData = 0;
			}
			else {
				if (token[0] == '*')
					// Write an N/A value
					pData = fNAV;
				else {

					switch (Indicator) {
						case 'A':
						case 'I': pData=atof(token)/fDiv[dPrec]; break;
						default:
							cout << "Unknown Indicator: " << Indicator << endl;
							return E_FAIL;
					}	
				}
			}
		}
        if ((*pData) != 0)
		DB->put_DataPoint(Index, pData);
		
		//The indicator
		bDone = (TS->GetNextToken(token) == S_FALSE);

	}