i am working on a program to find the factorial of a number of any length. i have used an integer array to store the digits of the result. the problem is that i am unable to store more than 32000 digits in the array. if i give a larger value then it gives an error message "array size too large". i`ve tried using an character array .in case of the character array it doesn`t give any error but on running the computer hangs.
is there any way by which i can store more no. of digits.
varunrathi
0
Light Poster
Recommended Answers
Jump to PostPerhaps you can try storing the result in a linked list instead of in an array. Linked lists can be of variable size. Be sure to also take into consideration the amount of RAM of the computer running your program!
Jump to Postto varunrathi,
I believe u need to be a little more specific with ur problem. We also need to know a few more things...
1. U r using static arrays right? Why dont u try dynamic memory allocation with pointers? Even then the amount of memory is always …
Jump to PostHello,
I too would go with a dynamic (pointer) linked list to achieve your desire of the "infinite calculator". The only other way around it would be to declare that your program can process x amount of digits, and if the array fills up, send an error message to …
All 10 Replies
Dani
3,986
The Queen of DaniWeb
Administrator
Featured Poster
Premium Member
Asif_NSU
25
Posting Whiz
kc0arf
68
Posting Virtuoso
Team Colleague
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
1o0oBhP
4
Posting Pro in Training
Narue
5,707
Bad Cop
Team Colleague
harshchandra
-3
Junior Poster in Training
Narue
5,707
Bad Cop
Team Colleague
resat.1907
0
Newbie Poster
gerard4143
371
Nearly a Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.