Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Several questions about c.
Several questions about c.
What are the data types in C language? 1) is divided into integer type and floating decimal type (called real number type) according to the number system nature of data. 2) According to whether the data is signed or not, it is divided into signed type and unsigned type. 3) There are four types of data length: 8bit, 16bit, 32bit and 64bit. 1) Integer variables are divided into basic types: int a, b, c; Short integer: short int (short) i, j, k; Long integer: long int(long) a, b, c; Unsigned unsigned integer: unsigned int a, b, c; Signed unsigned short integer: unsigned short k, j, il; type unsigned long integer:unsigned long b,s,u; The definition statement must start with ";" Starting at the end of the number, you can define multiple variables at the same time, separated by commas. To represent a long integer variable, you should add a letter "L" or "L" after the integer variable. 2) Storage form of integers in memory: 1) Positive integer Inta = 5; A is stored in memory as follows: 0000000000000 1 kloc-0/in the form of "original code", with the high byte bits stored in1byte and the low byte bits stored in one byte. 2) Negative integers are stored in memory in the form of "complement" in C language. Example: -5 The storage in memory is represented by 2 bytes; 111111111. Convert 0 into 1, and the complement of 00000 10 11111. So 11110 plus1is1165438. It is represented by two bytes, namely:111111165438. The steps to convert a binary code into a decimal negative integer are as follows: a) First, each bit is negated, for example, there is a complement11010, and the negated bit is 00010. B) Convert the obtained binary number into a decimal number, for example, the decimal number of 00000 10 1 is 5. C) Because the highest digit of 1 11010 is1,a minus sign is added before the decimal, that is, -5.d) Subtract the calculated number by1,that is. So it can be seen from the above that the smallest integer stored in two bytes is 100000000000, and its decimal number is-32768; The binary code of-1 is111111/65438+. 3) Unsigned Integer When an integer is stored in two bytes, the highest bit of the unsigned integer is no longer used to store the symbol of the integer. All binary bits of 16 are used to store integers. When all binary bits of 16 are 1, it represents an integer of 65535. 4) Single precision type of real variable: floating point 4 bytes double precision type: suspected 8 bytes.