Home > Net >  C # along with the gender notes: value types and naming rules
C # along with the gender notes: value types and naming rules

Time:10-05

Note: single-line comments//

Multiline comment/*

*/

Note: the multiline comment can be nested single-line comments

The purpose of the calculator, it is mainly used to help people processing data,

Constants: in the operation of the computer the same amount of

Integer constants:

Floating-point constants:

Character constants:

String constants:

Variables: in the operation of the computer can change the amount of

Define a variable, the type of the variable name=value;

Char types to use single quotes Char a="d"; Can is a space

Data type

Int the integer class 4 bytes

Float single-precision floating-point type 4 bytes (float type f) after

Double double-precision floating-point type 8 bytes (the default is type double)

A decimal precision floating-point number 16 bytes (behind the decimal plus m)

Char character type 2 bytes

String string type

Boolean logic value (true/false) 1 byte true/false

Key words have special meaning, can't use,

Data types classified two categories: value types and reference types

Character conversion

Int h=20;

Int m=30;

Int temp=h;

H=m;

M=temp.

Variable naming rules

1, the same variable name cannot be repeated definition;

2, the variable names cannot begin with Numbers;

3, variable naming it can contain only letters, Numbers, underscore;

4, variable names are case sensitive.

5, see knowledge meaning

6, hump named hair, all lowercase for the first word, starting from the two words, capitalize the first letter; For example: totalAcore;

CodePudding user response:

CodePudding user response:

CodePudding user response:

CodePudding user response:

CodePudding user response:

CodePudding user response:

CodePudding user response:

CodePudding user response:

CodePudding user response:

CodePudding user response:

CodePudding user response:

  •  Tags:  
  • C#
  • Related