¼ýÀÚÇü ÀÚ·á

¼öÄ¡¸¦ ÀúÀåÇÏ´Â º¯¼öÇü ¼±¾ð

ÀÚ·áÇü º¯¼ö, º¯¼ö, ... ;

¿¹)

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;



ÀÚ·áÇü¿¡ µû¸¥ °ª Çã¿ë ¹üÀ§
ÀÚ·áÇü
Bytes
Çã¿ë °ª ¹üÀ§
short (int)2 ÀÌ»ó-32768 ~ 32767
int2 or 4-32768 ~ 32767 or -2147483648 ~ 2147483647
unsigned (int)2 or 40 ~ 65535 or 0 ~ 4294967295
long (int)4 ÀÌ»ó-2147483648 ~ 2147483647
float410-38 ~ 1038
double810-308 ~ 10308
char1ASCII Value (-128 ~ 127)
unsigned char10 ~ 255

* Byte ¼ö´Â ÄÄÇ»ÅÍ È¯°æ¿¡ µû¶ó ´Ù¸§. sizeof·Î °Ë»ç °¡´É

            sizeof(int), sizeof(double) µî


¼ýÀÚ»ó¼ö : À¯È¿ ¼ýÀÚ ¹üÀ§¿¡ ÁÖÀÇ

¼ýÀÚ»ó¼ö ¿¹)

  • 32767
  • 65535U
  • 2148473647L
  • 4294967295UL
  • 3.1415
  • 3.141592D
  • 0xff
  • 0xFF
  • 0XFF
  • 077
  • 037
  • 2.9979E+8
  • ¹®ÀÚ»ó¼ö
    ÀÛÀº µû¿ÈÇ¥(' ')·Î µÑ·¯½ÎÀÎ ´ÜÀÏ ¹®ÀÚ. 'A', 'B', '$' µî. ASCII ÄÚµå °ªÀ¸·Î ÀúÀåµÊ.

    Escape sequence
    Ưº°ÇÑ ±â´ÉÀ» °®´Â ¹®ÀÚ »ó¼öÀÇ ÀÏÁ¾. '\n', '\t', '\'', '\xff', '\0' µî.

    ¹®ÀÚ¿­ »ó¼ö
    " "·Î µÑ·¯½ÎÀÎ ¹®ÀÚ¿­. '\0' (Null character¶ó ºÒ¸²)·Î ³¡³².

    ÀÌÇ× ¿¬»êÀÚ (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 );
    

    [ Table Of Contents | Previous Chapter | Next Chapter]