+ 3
This program is to give the sizeof data types, But why it's giving output as 4 for int.
3 Antworten
+ 12
The sizeof returns number of bytes required for the certain type you passed to it. In this case you passed int and get 4 bytes, or 32 bit (one byte = 8 bit), however, actual size of each type depends on system and compiler.
Hth, cmiiw
+ 4
Ipang Not of all types. There are actually types specially made to have fixed sizes, like _u16(i think its this way) and its family.
+ 3
Because an int is actually most of the time 4 bytes :)
I said "most of the time" because it's really compiler dependant so using sizeof is a good practice to ensure your program will compile on most machines :)