# Maximum number input in C

6/13/2019 4:16:52 PM

Warith Vatanaplachaigoon5 Answers

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

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.

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.

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.