Learning Unity 3D game development daily notes (C #)

2019.7.9

1, 1 byte = 8 bits each is 0 or 1.
2, the leftmost one represents the positive and negative, 0: negative 1: positive.
3, numeric ranges, -2 N (the number of bits minus the sign bit. 1) ~ 2 N -1.
4,1G = 1024M 1M = 1024K 1K = 1024Byte 1Byte = 8bit (bitcoin).
5,

Types of Whether the symbol Occupies the number of bytes Allowed values ​​range
sbyte Have 1 (8-position) -27 ~ 27-1(-128 ~ 127)
short Have 2 (16th) -215 ~ 215-1
int (default integer type) Have 4 (# 32) -231 ~ 231-1
long Have 8 (position 64) -263~263-1
byte no 1 0~28-1(0 ~ 255)
ushort no 2 0~16-1(0 ~ 65535)
uint no 3 0 ~ 232 -1
ulong no 4 0 ~ 264-1

6、

Types of Occupies the number of bytes effective number
float (single-precision) (with up to, but not the default) 4 1 (8-position)
double (double precision) (default decimal type) 8 2 (16th)
decimal 16 4 (# 32)

7.
string: can no character (string str = "") is a reference type, there is no accounting for how many say.
Characters: there is only one character (char c = '1') .
Only string is a reference, the other is a value type.
char: is a value type, two bytes.
sizeof (char) Type the number of bytes can be calculated.
BOOL: boolean: 1 byte.
8,
variable naming rules:
must begin ① variable name with a letter or an underscore "_."
② variable names can only contain letters, numbers, combined underlined.
③ variable name can not use the keyword programming language.
④ can not be coincidence, and other variables and methods.
print C # may be used to define the variable name
9, the operator, the first operator multiplication and division, the subtraction operator, operator parentheses brackets.
10, when the "+" side there is a string, "+" has become a hyphen.
11, two types of data to actually divide int, int is obtained, even if the fractional part, rounding the fractional part directly, rather than rounded.
12, float can not be converted int, int can be converted to a float
13 is, when multiplied by an int and a float, the float is changed to stresses int Xiangcheng.

Guess you like

Origin blog.csdn.net/weixin_43814599/article/details/95220738