I have an array and simple loop:
static BigInteger[] dataSet = new BigInteger[] { 100913, 1009139, 10091401, 100914061, 1009140611, 10091406133, 100914061337, 1009140613399 };
foreach (BigInteger num in dataSet ) {
BigInteger[] Vector = new BigInteger[num];
for (BigInteger i = 1; i <= num; i++) {
Vector[i - 1] = i;
}
}
Can anyone explain why this code returns
Cannot implicitly convert type 'System.Numerics.BigInteger' to 'int'. An explicit conversion exists (are you missing a cast?)
Error appears in this line:
BigInteger[] Vector = new BigInteger[num];
Everything is converted to BigInteger, I do not see the possible reasons.
Will be thankful for help,
Thanks in advance,
num is a BigInteger but you are using it to initialise the size of your array:
BigInteger[] Vector = new BigInteger[num];
The indexer of an array is int, meaning that largest size you can create is int.MaxValue (2,147,483,647).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With