Hi I have an issue with an, "Illegal use of floating point in function"
1 2 3 4 5 6 7 8
for (double i = 0; i < numTerms; i++)
{
if (term == Terms[i])
{
returntrue;
}
}
returnfalse;
Anyone know how I can implement this? the error comes when I use the floating point 'i' inside Terms[i].. I am basically trying to handle a very large number of terms..
that makes perfect sense, and I was thinking the same thing, I just didn't know how to get past that..
I just looked up what the max value a long and int can both have, and they both seem to be the same value? See below.. I thought I used unsigned, but it looks like I didn't.. I'll see if I can get away with unsigned.. Or otherwise.. I'll give 'long' a shot.. is there another value besides 'long' I can use thats even bigger? Thanks again!
INT_MIN
Minimum value for a variable of type int.
–2147483648
INT_MAX
Maximum value for a variable of type int.
2147483647
UINT_MAX
Maximum value for a variable of type unsigned int.
4294967295 (0xffffffff)
LONG_MIN
Minimum value for a variable of type long.
–2147483648
LONG_MAX
Maximum value for a variable of type long.
2147483647
ULONG_MAX
Maximum value for a variable of type unsigned long.
4294967295 (0xffffffff)
is there another value besides 'long' I can use thats even bigger? yes there is (like long long or __int64 (Microsoft specific)) but don't use it as an index of a loop you don't want to loop that often
If your requirement is so unique that the number of Terms can actually "burst" the datatype limits, then I think you can no longer just use pure memory. You may need to consider the need to have text file or even database to store those data. Then read them in batches and process them in batches. Something like when items too huge to be sorted in pure memory, we use file to store intermediate results like merge sort does.