C data type

int

  The int data type is used for variaables that will store integers.

  Intergers always take up 4bytes of memory(32bits).This means the range of values they can store is necessarily limited to 32 bits worth of information.

unsigned int

  Unsigned is a qualifier that can be applied to certain types (including int),which effectively doubles the positive range of variable of that type, at the cost of disallowing any negative values.

char

  The char data type is used for variables that will store single characters.

  Characters always take up 1 byte of memory (8 bytes).This means the range of values they can store is necessarily limited to 8 bits worth of information

  Thanks to ASCII(a:ski),we've developed a mapping of characters lie A,B,C,etc...to numeric values in the positive side of this range.

float

  The float data type is used for variables that will store floating-point values ,also know as real numbers.

  Floating points values always take up 4 bytes of memory(32 bits).

  It's a little complicated to describe the range of a float,but suffice it to say with 32 bits of precision,some of which mingt be used for an integer part,we are limited in how precise we can be.

double

  The double data type is used for variables that will store floating-point values,also known as real number

  The difference is that double are double precision.They always take up 8 bytes of memory (64 bits).

  With an additional 32 bits of precision relative to a float,doubles allow us to be specify much more precise real number.

猜你喜欢

转载自www.cnblogs.com/jllin/p/9924998.html