13._c Programming Preparation Computer Expertise

Source: Internet
Author: User

C Language Programming Preparation knowledge

1.CPU Memory strip HDD Graphics board monitor relationship

    

How the 2.HelloWorld program works

Run with link, compile

3. What is a data type

Basic type Data

Integer

Integer int four bytes

           

1# include <stdio.h>2 3 intMainvoid)4 {5     inti =Ten;//indicates that the I variable is an integer variable, so-called integer variable means I can only hold integers. 6 7printf"%d\n", i);8 9     return 0;Ten}

Note: If I = 10.5 is changed, compilation generates a warning, but the result is the same as the previous one because the data type conversion has occurred. This is also the C language is not strictly caused. The Java syntax format is stricter than C.

short int two-byte

Long int eight-byte

Floating point number (real number)

Single-precision floating-point number float takes four bytes, one byte eight bits

Double-precision floating-point number double takes eight bytes

Character Char A byte note: There is no string type in the C language, and a character array is typically implemented in C when a string (a series of characters) is required.

       

Composite type data (piecing together the basic types)

Structural body

Enumeration

Shared body

4. What is a variable

The essence of a variable is the amount of space in memory

1# include <stdio.h>2 3 intMainvoid)4 {5     inti;6     7i =3;//3 is eventually stored in memory, and after the program terminates, 3 of the occupied space is released8 9printf"i =%d\n", i);Ten  One     return 0; A}

5.CPU memory Stripe VC6.0 The relationship between the operating system

6. Why variables must be initialized (emphasis)

   The so-called initialization is the meaning of assignment.

Software operation vs. memory (junk data)

Memory is used under the unified management of the operating system!

1. The software needs to request storage space to the operating system before it runs, and when the memory space is sufficient, the operating system allocates a memory space and copies a copy of the software in the external memory into that memory space and initiates the operation of the software.

2. During the software run time, the space occupied by the software is no longer allocated to other software.

3. When the software is finished, the operating system reclaims the memory space ( Note: The operating system does not empty the data left in the memory space ), so that it can be allocated to other software again.

In summary, the space allocated by a software is likely to have residual data that was previously used by other software, known as junk data. So normally we have a variable, an array, and the memory space is initialized after the storage space is allocated.    

7. How to define Variables

Data type variable name = value to be assigned;

Equivalent to

Data type variable name;

Variable name = the value to be assigned;

Example:

int i = 3;    equivalent to int i; i = 3;

int I, J;   equivalent to int i; Int J;

int I, j = 3; equivalent to int i; Int J; j = 3;

int i = 3, j = 5; equivalent to int i; Int J; i = 3; j = 5;

int I, J;   i = j = 5; equivalent to int i, J; i = 5; j = 5;

8. What is a binary

Decimal is every ten into one, binary is every second into a

1# include <stdio.h>2 3 intMainvoid)4 {5     inti = the;6 7printf"i =%x\n", i);8     /*9 the use of printfTen %d means output in decimal One %x or%x to indicate hexadecimal output A %o indicates an octal output -      -     */ the  -     returni; -}

9. How constants are represented in the C language

Integer

Decimal: The traditional

Hex: Front plus 0x or 0X

Octal: Front plus 0 Digit zero, non o

1# include <stdio.h>2 3 intMainvoid)4 {5     inti =015;//octal front plus 06printf"i =%d\n", i);7 8     return 0;9 Ten}

Floating point number

The traditional notation

float x = 3.2;

Scientific counting method

float x = 3.2e3; The value of X is 3200

float x = 123.45e-2; The value of X is 1.2345

1# include <stdio.h>2 3 intMainvoid)4 {5     floatx =123.45e-2;//123.45e-2 default is double type, strict notation is foat x = 123.45e-2f6printf"x =%f\n", x);7 8     return 0;9 Ten}

Character

Single character enclosed in single quotation marks.

' A ' denotes character a (correct)

' ABC ' (Error) "ABC" (correct)

strings are enclosed in double quotation marks.

"A" is correct, because "a" represents a combination of ' a '

      

      

10. Constants with what binary code is stored on the computer

Integers are converted in the form of complement to binary code stored in the computer.

Real numbers are converted to binary code stored in the computer by the IEEE754 standard.

The nature of the character is actually the same as the integer storage

13._c Programming Preparation Computer Expertise

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.