I have a number which is 5000 digits long. I want to store it in an array like int num[5000]
as separated digits. Like num[0]
will contain the first digit, num[12]
the 13th and so on. And of course I am not going to add that many commas. So, what can I do?
Asked
Active
Viewed 37 times
1

Akshat Vats
- 145
- 7
-
are you going to enter those number one by one and pressing enter? – Ankit Mishra Jun 30 '20 at 06:36
-
No, like ```char[10] = "abcdefghi"``` automatically stores the characters in respective indices, is there a workaround for integers? – Akshat Vats Jun 30 '20 at 06:39
-
so so you will pass string ? and we have to store in int array every digit? – Ankit Mishra Jun 30 '20 at 06:40
-
You'll want to look at how the various available "bigint" libraries are implemented. – Lundin Jun 30 '20 at 06:40
-
Well how about doing it exactly like that `char num[] = "5000123456789123456789...";` ? You are not going to need the full range of an `int` for single digits anyway. Then convert it with `-'0'` when using it. – Yunnosch Jun 30 '20 at 06:40