Entry C language books --- Chapter III

======= ========= Variables and Data Types

Description: char, short int int int long single-precision floating-point double-precision floating-point untyped

Data Type: char short int long float double void

Length 32 Environment: 124448  

====== ==== outputs various types of data on a screen

puts the output string is

printf can not only output string, may also output integer, decimal, single characters, etc., and their output format defined, for example:

  1. Output in decimal, octal, hexadecimal form;

  2. The required digital output representing the position of n characters;

  3. Control mice bits.

printf print format is an abbreviation, meaning: format printing,

  int abc = 9;

  printf("%d",abc);

% D: d is the abbreviation of decimal, it means a decimal number,% d represents an output in the form of a decimal integer.

% D: format control characters, which indicates the form in which the output data. Format control characters are beginning%.

% D: output as a decimal integer.

% C: output a character, c is the character shorthand.

% S: Output a string. s is shorthand string.

% F: a decimal output. f is the float shorthand.

"\ N": line breaks.

% Hd: for outputting short int type, hd is shorthand for short decimal.

% Ld: for outputting a long int, ld is long decimal shorthand.

% F: Output type float in decimal form;

% Lf: Output type double in decimal form;

% E: Output type float exponentially, e output in lower case.

% E: Output type float exponentially, E uppercase output results.

Ouble% le Output Type exponentially, e output in lower case.

% LE output type double exponentially, E uppercase output results.

% G: compare decimal form and exponential form of decimal, the shortest way to class output decimals, so that the resulting output of more brief.

 

 

After the completion of the output will be automatically puts new line, printf will not need to add a line break their own, which is a difference between puts and printf in the output string.

When the continuous output puts a long string, it can be used directly for quotes distinguished.

For example: puts (

      "1111111111111111"

      "22222222222222"

      "33333333333333"

      );

=========== operator =========

sizeof operator: is used to obtain the data types.

Binary ========== =======

Note: The standard C language does not support the following binary wording, but some compilers himself was extended only support binary numbers.

Binary: the Ob or the beginning of the OB, is not case sensitive.

For example: int a = Ob101; // converted to decimal 5

Octal: int a = 015; [0] // numbers beginning converted to decimal 13

C language commonly used in integer has short, int, long three types by the printf function, they can be output in octal, decimal and hexadecimal form.

  Output: short int long type

  Octal:% ho% o% lo

  Decimal:% hd% d% ld

  Hex:% hx or% hX% x or% X% lx, or% lX 

Note: The hexadecimal representation of the number used in the English alphabet, there is case-sensitive, x represents the output lowercase hexadecimal numbers in lowercase, X uppercase hexadecimal number represents the output in the form of capital letters.

Binary output during different time required to bring a particular prefix in the output. Format control characters can be output in the # prefix, for example:% #,% # o the like.

========= ====== sign bit

If it is determined numbers can only be positive, such as class sizes, the length of the string, such as memory address, this time the sign bit is redundant, it is better to delete the sign bit, all the bits are used to store values, this can indicate the range of values ​​is even greater (twice as large). Use the keyword unsigned.

For example: unsigned int a = 1002;

====== C language in decimal (float double) ==========

Exponential form: aEn, or aen, a: mantissa part, is a decimal number, n-exponential part is a decimal integer. E e is the fixed character or for dividing the mantissa portion and exponent portion. Expression is equivalent to earn a; N-th power of a * 10.

 

Guess you like

Origin www.cnblogs.com/dagailun/p/12346761.html