cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Storing Doubles in Memory
Storing Doubles in Memory
May 16, 2011 at 7:52pm UTC
TheMadScientist
(22)
How can I do this?
void Object::SetValues(double Count ...)
{
va_list values;
this->NumberOfValues=Count;
va_start(values,Count);
for(long long i=0; i<Count; i++) {
this->Values[i] = va_arg(values, double);
std::cout<<this->Values[i]<<" ";
}
va_end(values);
}
Doesn't work.
When I put in: 5, 1, 0, 0, 0, 0
I get: 4.94066e-324, 0, 0, -9.2596e+061, 2.26224e-306
I need floating and not integral types. How can I store and retrieve these in memory?
May 16, 2011 at 8:03pm UTC
m4ster r0shi
(2201)
Count should probably be an integer.
There is an example here ->
http://cplusplus.com/reference/clibrary/cstdarg/va_start/
May 16, 2011 at 9:00pm UTC
anonymous23323124
(1383)
Just to clarify, if you were thinking
Count
had to be the same type as the variable arguments, then this is not the case.
Count
is just supposed to be the number of arguments, and hence an integral type.
Topic archived. No new replies allowed.