1, C ";"
Define variables: int c; int c=0; int c=1,b=2; int c=1;b=2; wrong.
Note: Statements and data are always declared with a; end, and then things are not counted within.
------------------------------------------------------------------------------------
2. Create a C file and a detailed working space:
Workspace = Working space
Structure is: Workspace-Project space-specific documents (c files belong to specific documents)
The files and projects in C must be placed in the project space of the workspace and cannot be stored separately.
Workspace and project file names must be specified, but directories can be the same.
-----------------------------------------------------------------------------------
<1> If we specify a different directory and root directory for the workspace, the compilation system creates a new folder under the root directory, which is the name of the workspace.
If we specify a different project control and a working control, a folder is created under the workspace. Ditto.
First: When creating a workspace, specify the root directory, such as F:\VC, to specify a workspace: such as workspace, the final effect is to create a folder in the F:\VC directory, the name of this folder is workspace, There are three files in this working control, respectively: WORKSPACE.DSP; WORKSPACE.NCB; WORKSPACE.OBT;
Then create a new project space in the workspace and create a new. dsp file and a debug folder in the workspace.
-----------------------------------------------------------------------------------
<2>
However, we may not specify the work and project space, this time the system defaults to the workspace directory = root directory, so the configuration files in the workspace are in the root directory, and then because you have to create a project space Ah, so project space = workspace, project space in the configuration file is also located under the root directory. Also, all of the configuration files are prefixed with the file name of the C file.
This time if we just create a new one. C files such as: test.c (Path is F:\VC\test. C), and then compile it requires us to create a new active workspace, if we have already used this method to establish a workspace, the compilation system will prompt us to use the original workspace, if it is the first time to establish a workspace, the compiler will be the VC for the work of the root directory of the control, The current file name test creates three test.dsp,.ncb,.obt files for the workspace name, three files located in the root directory, and a new project file in the VC root directory, This project file contains the TEST.DSP file and a debug file, which is used primarily for the compilation and execution of. c files.
-----------------------------------------------------------------------------------
3. Declaration of Symbolic constants: #define PI
Int,short,long,char,float,double,void,enum corresponds to the number of bytes occupied:
4 2 4 1 4 8 0 4
Note: The number of bytes occupied depends on the compilation system
The type of int in the VC occupies 4 bytes, which means that an int type data consists of 32 0/1 encodings, which can represent 2 of 16 times to +2 of 16 of 2 of the number of parties.
(At the same time we want to know: the ordinary int type of 32-bit binary is not used to denote a numeric value, where the first bit is used to denote the sign bit, the highest 32-bit binary number is 2 of the 31, the maximum is 2 31 square-1, up to 2 of the 32 -1+1 number "because to Count 0", But because positive negative numbers are divided into half, we also want to show 2 of the number of 32, we will count 0 is a positive, 3210-1-2-3-4, just from 0 to do 2 of 16 of the number of 1 times from 2 to the right 16 of the absolute value of the large and small 1. So the range is +2 of the 16 square-1 to 2 of the 16-th number)
(If it is a special int type: The unsigned type represents 2 of the 32-second square)
The char type refers to a character variable, where only one character, such as ' a ' (denoted by single quotation marks) is stored.
If you want to represent Chinese characters with a char type, you need two bytes, represented by a character array.
string is of type
Overflow: 32767+1->-32768
<1>bit
Bits: bits are the smallest unit of data stored in a computer, which refers to a number of bits in a binary number with a value of "0" or "1".
<2>byte Bytes: bytes are the basic unit of computer storage capacity, and one byte consists of a 8-bit binary number. Inside a computer, a byte can represent a data, or it can represent an English letter, and two bytes can represent a single character.
1b=8bit, bytes are the basic unit in which computers store information.
<3> characters
Characters are numbers and symbols used in a computer, including: 1, 2, 3, A, B, C, ~! #¥%......-* ()--+, and so on. 1 Kanji character stores require 2 bytes, and 1 English characters are stored in 1 bytes.
-----------------------------------------------------------------------------------
4, for shaping and floating-point data operations, the type level from low to high conversion, from the range of small to large conversion
Char/short->int->unsig->long->double, or float->double.
In the process of operation, if a book is a float/double type of data, the final result is a double type.
Journal of
C-Create files and workspaces