# Int size

Someone has told me that I can have a int of any length. For example: if need a 8 bytes number, I can make it!
My question is: "Is that possible?".
I was thinking abou using typedef... HELP!
GS

• You could use a short data type. otherwise, you could use an int, but shift right 8. The int would look something like this in binary.

00000000????????

Kuphryn
• : Someone has told me that I can have a int of any length. For example: if need a 8 bytes number, I can make it!
: My question is: "Is that possible?".
: I was thinking abou using typedef... HELP!
: GS
:
Outside of the standard types you need an additional library like
http://www.swox.com/gmp/

You can have 8 byte numbers from the outset, if your processor is 64 bit.

• : Someone has told me that I can have a int of any length. For example: if need a 8 bytes number, I can make it!
: My question is: "Is that possible?".
: I was thinking abou using typedef... HELP!
: GS
:

There are a set of integer types. Each type has a different size.

For Example:

char is 1 byte
short is 2 bytes
int is 4 bytes
int64 is 8 bytes

Using int64 types is usually quite inefficient. I mean that adding 2 int64 variables together will take the computer a lot longer than adding 2 int variables together. Making you own integer types would be even slower so I don't suggest it.
• : : Someone has told me that I can have a int of any length. For example: if need a 8 bytes number, I can make it!
: : My question is: "Is that possible?".
: : I was thinking abou using typedef... HELP!
: : GS
: :
:
: There are a set of integer types. Each type has a different size.
:
: For Example:
:
: char is 1 byte
: short is 2 bytes
: int is 4 bytes
: int64 is 8 bytes
:
: Using int64 types is usually quite inefficient. I mean that adding 2 int64 variables together will take the computer a lot longer than adding 2 int variables together. Making you own integer types would be even slower so I don't suggest it.
:
Thanks everyone. But efficiency isnt the problem. I was just curious about this. The main problem was solve fatorial of high numbers.

• : : There are a set of integer types. Each type has a different size.
: :
: : For Example:
: :
: : char is 1 byte
: : short is 2 bytes
: : int is 4 bytes
: : int64 is 8 bytes
: :
: : Using int64 types is usually quite inefficient. I mean that adding 2 int64 variables together will take the computer a lot longer than adding 2 int variables together. Making you own integer types would be even slower so I don't suggest it.
: :
: Thanks everyone. But efficiency isnt the problem. I was just curious about this. The main problem was solve fatorial of high numbers.
:

For factorials, you can try using int64 or maybe even float. You could try using a float like an integer. The range is much larger for a float because it uses exponencial information. The only drawback is that it may not be perfectly accurate.
• : : Someone has told me that I can have a int of any length. For example: if need a 8 bytes number, I can make it!
: : My question is: "Is that possible?".
: : I was thinking abou using typedef... HELP!
: : GS
: :
:
: There are a set of integer types. Each type has a different size.
:
: For Example:
:
: char is 1 byte
: short is 2 bytes
: int is 4 bytes
: int64 is 8 bytes
the standard portable form would be int32_t and int64_t - you need stdint.h for that.(a 64bit machine has sizeof(int)=8). or, if your int is 4 bytes and your compiler supports it, use long long for 8 bytes.

• Ok, thanks a lot!. Ill see what fits best to my problem .