Handling enormous data in C

Can anyone describe an efficient approach to handle enormous data of the orser of 10^100 in C,without using built in large data types,like long long etc.

string handling is the best approach

“without using built in large data types,like long long etc.” -> You can not use that either.

Using string or linked lists can do your work. It depends on the problem.

You can have a look at few solutions of the problem Fair and Square Large 2 from GCJ 2013 Qualification Round.

Edit Or you can also look for solutions for problem Small Factorials here at Codechef.

@kuruma has come with a nice editorial for handling large numbers and multiplying it the way we used to do in school. Or you can have a look on the official Codechef tutorial for the same problem.

1 Like


Actually the best approach would be a combination of what @bugkiller and @hariprasath mentioned, i.e. , if you know beforehand that the input data will exceed any built-in data type, you need to use strings to read the entire data properly…

After reading the data in string format, you can parse the string, by placing only one digit at a time onto an array, and do the operations from there :slight_smile:

Good Luck,


1 Like