¿¹)
short int i1; short i2; unsigned short i3; int i, j, k; unsigned i4; long l1; unsigned long l2; float f; double x, y, z;
short (int) | 2 ÀÌ»ó | -32768 ~ 32767 |
int | 2 or 4 | -32768 ~ 32767 or -2147483648 ~ 2147483647 |
unsigned (int) | 2 or 4 | 0 ~ 65535 or 0 ~ 4294967295 |
long (int) | 4 ÀÌ»ó | -2147483648 ~ 2147483647 |
float | 4 | 10-38 ~ 1038 |
double | 8 | 10-308 ~ 10308 |
char | 1 | ASCII Value (-128 ~ 127) |
unsigned char | 1 | 0 ~ 255 |
* Byte ¼ö´Â ÄÄÇ»ÅÍ È¯°æ¿¡ µû¶ó ´Ù¸§. sizeof·Î °Ë»ç °¡´É
sizeof(int), sizeof(double) µî
¼ýÀÚ»ó¼ö : À¯È¿ ¼ýÀÚ ¹üÀ§¿¡ ÁÖÀÇ
¼ýÀÚ»ó¼ö ¿¹)
ÀÌÇ× ¿¬»êÀÚ (Binary operators) : +, -, *, /, %
a + b 3.14 * 2 5 / 2 5 % 2
¼·Î ´Ù¸¥ ÀÚ·áÇü¿¡ ´ëÇÑ ¿¬»ê ½Ã C´Â ÀÚµ¿ Çü º¯È¯ ±â´ÉÀ» Á¦°øÇÑ´Ù. (Implicit type castingÀ̶ó ÇÔ)
±×·¯³ª Type casting operationÀ» ÀÌ¿ëÇÑ explicit type casting [Type_name (expression)]ÀÌ ¹Ù¶÷Á÷ÇÏ´Ù. (Why?)
¿¹) int i; double r, s; i = (int) (3.14 * r * r); i = (int) 3.14 * r * r; s = sqrt( (double) i );