+ 4

# Maximum number input in C

What is the maximum whole number that can be input in C?

4 Answers

+ 4

These are defined in <limits.h>. For example, INT_MAX is at least 32767, but is 2147483647 on most systems.

+ 2

Depends on what youâ€™re storing it in. An unsigned 32 bit integer? Signed? I would suggest googling maximum value of an integer or whatever you are storing the number in.

+ 1

You can calculate it easily. A bit can have 2 states (1 or 0). If 1 byte has 8 bits, you can have 2^8 = 256 combinations. 255 numbers because one bit is used for positive sign.
The maximum int type is unsigned long (8 bytes size), so the maximum whole number you can use is the result of 256^8.

+ 1

Thank you Warith Vatanaplachaigoon for the upvote (I see someone has downvoted me a I don't know why...) Anyway, I hope you found my answer useful. Maths can be a good tool if you need to work in a system without access to extra libraries.
The maximum whole number you can use is very big and yesterday I tried several times to add it to my comment, but seems sololearn doesn't accept such large words. I can put a screenshot in case anyone is interested.