+10

Size of integer?

1/14/2020 2:12:06 PM

Sakshi Thakur🌸

+10

When dealing with 16bit processes it is 2 Bytes Otherwise When you are dealing with 32 or 64 bit processors then it is 4 Bytes(just like Roman Ignatev said)

+7

Thankyou Arsenic and if I am not wrong sizeof() is operator not function right?

+6

4 bytes of memory space and ranges from -2147483648 to 2147483647

+5

Thankyou Arsenic and Roman Ignatev, we can say compiler dependent

+5

Yes Sakshi Thakur🌸 looks like you are right👇 https://en.m.wikipedia.org/wiki/Sizeof I Learned new stuff today, thanks🙂🙃

+4

Sakshi Thakur🌸 generally most of the modern compillars use 32 or 64 bit processing. But still to confirm, you can always use sizeof () function in C/C++ to know the exact size according to your compiler

+4

Great!

+4

Size varies according to the processors(32 or 64 bit) Better to use sizeof( ) function to know the exact value

+3

Yes sizeof() is an operator, not a function. More specifically it is a compile time operator, that means the size of the item must be known at compile time. Hence... char foo[80]; int sz = sizeof(foo); // sz is now 80 since this works many people wrongly assume that you can use sizeof() to determine the size of an array passed to a function - you cannot. The above example works because there is a statically sized array in scope with the sizeof() operator thus the compiler can determine the size. The size of an array passed to a function cannot be determined at compile time since any array could be passed to the function at run time. Thus the confusion.

+3

Flayer you are right but in this case sizeof() is an operator

+2

Cout<< sizeof(int);

+2

-2147483648 to 2147483747

+2

Begench no, integer cannot hold 8 bytes. It can be either 2 bytes or 4 bytes.

+2

Ishan Shah, Reza_PCH, ANIL K YADAV, Pravesh Maurya

+1

It depends on the compiler but at least 4 bytes

+1

Size of integer can vary for different systems (different processors 16 bit or 32/64 bit) Mostly the size of int is 4 bytes

+1

4 bytes

+1

Sakshi If it has parentheses it's method

0

Normally it's 2byte

0

4 bytes in c++ but in turbo c++/other operating system it may varies