This is the 27th day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021.”

Recently, I want to review C language, so I will update an article about C language in nuggets every day! Freshmen who are just learning C, and those who want to review C /C++, don’t miss it! Solid foundation, slow down is fast!

Introduction to Data Types

Char // Character data type short // short int // integer long // longlong // longer integer float // single precision floating point double // double precision floating point //C language has a string type? - > noCopy the code

Meaning of type:

1. The size of the memory space opened with this type (size determines the scope of use). 2. Perspective on how to view memory space.


Basic classification of types:

Plastic Family:

char
unsignedchar
signedchar
short
unsignedshort [int]
signedshort [int]
int
unsignedint
signedint
long
unsignedlong [int]
signedlong [int]

Copy the code

Floating point family:

float
double
Copy the code

Construction type:

> Array type > struct type > enum type enum > Union type unionCopy the code

Pointer types

int*pi;
char*pc;
float*pf;
void*pv;
Copy the code

Air type:

Void denotes an empty type (no type) and is usually applied to function return types, function parameters, and pointer types.Copy the code

The concept of source code inverse code complement

There are three ways to represent signed numbers in computer, namely source code, inverse code and complement code. All the three methods have two parts: sign bit and numerical bit. The sign bit is 0 to represent “positive” and 1 to represent “negative”, while the three methods of numerical bit are different.


The original code

You can translate binary directly into binary in terms of positive and negative numbers.

Radix-minus-one complement

The symbol bit of the original code is unchanged, and the other bits are reversed in turn.

complement

Inverse +1 gives you your complement.


The rules for calculating positive and negative numbers are different

Positive numbers have the same primitive, inverse, and complement. In the case of orthopedics: the data store memory actually stores the complement.


Why is everything in memory just complement

Why is that? In computer systems, values are represented and stored by complement codes. The reason is that, using complement code, the sign bit and number range can be unified processing; At the same time, addition and subtraction can also be unified processing (CPU only adder) in addition, complement code and source code conversion, its operation process is the same, do not need additional hardware circuit.


That’s all for today. Thank you for seeing us! Hope to help you! You are welcome to click on this topic and subscribe! At the same time, welcome the bigwigs to criticize and correct!