By type casting since int is of larger bits than short s=(int)i;
32 bits or 4 bytes and an int is not an address, it is a primitive so it directly access the data without a reference.
It depends on the type of integer (such as long, short, int and char) and the specific implementation of C++. The only guarantee is that a char must occupy one byte (sizeof(char)==1). An int is typically 32-bits (4 bytes), but only sizeof(int) can tell you for sure.
for C: sizeof (int), often 2 or 4 bytefor Java: 4 byte
It depends on the programming language, the compiler, and the machine architecture. In C, the size of short int and int is not mandated by the language. Often, on 32-bit machines, 'int' will be 32-bit, while 'short int' may be 16-bit. But the only thing the language promises is that short int will be no larger than int.
32 bits or 4 bytes. This depends heavily on the processor architecture your computer uses, AND the programming language you are using. Typically, an integer is 1 word in length, however that processor architecture defines "word". That could be 32-bits (4 bytes), 64-bits (8 bytes), 8-bits (1 byte), or even 9 bits (in certain old computers).
Generally 32-bits (4 bytes), however it depends on the language implementation and architecture. That is, the standard does not declare a datatype to be a specific size. As a rule of thumb, never assume the size of any variable type, always use the sizeof operator. For example: size_t s1 = sizeof(int); // datatype: parenthesis required int i; size_t s2 = sizeof i; // expression: no parenthesis required The sizeof operator is most useful when allocating memory of a given size. For example: int x[10]; int* p = (int*) malloc(sizeof x); // allocates memory for 10 integers
Because a character is an integer, not a real number. You probably meant int rather than integer, but no implementations of C++ treat a char as an int. All implementations are guaranteed to evaluate sizeof(char) as being exactly 1 (byte). Moreover, a string of 4 characters will occupy exactly 32-bits, not 128-bits (assuming an int is 32-bits, which is entirely dependant upon the implementation). When processing single characters the CPU will treat them according to the system's word length (which is 32 bits on a 32-bit machine), but that has nothing to do with C++ treating a char as an int, that's purely down to the architecture. After all, it's just as quick to manipulate 32 bits as it is to manipulate 8 bits on a 32-bit system. On a 64-bit system, a single char will be treated as if it were 64 bits long (8 bytes) for the same reason.
8*sizeof (long), usually 32 or 64
19,200 bits.
16 bits
We can define structure bit field members with Dot operators. EXAMPLE: #include <stdio.h> int main() { Struct bit_field { Int x.4; // it allocates only 4 bits to x Char C.6; // it allocates only 6 bits to C; }; return 0; }