Self-answer and C language (1)

Source: Internet
Author: User

Sort out the learning process and documents for each of the 10 blogs.
Question 1: Why is it classified into low-level and high-level languages.

Machine command: 00000010 machine instruction

Machine language: a set of 00000010 00001010 commands. Different machine models have different machine languages.

Evolved to-

Symbol language: add a, B symbolic language. The software must convert these symbols into machine languages. This process is called Assembly assemble. Therefore, the symbolic language is also called assemble language. similar to computers, machines of different models have different assembly languages, which are also called low-level languages. Only applicable to professionals.

Into again-"

Advanced Language: it does not rely on specific machines and conforms to human language habits. For example, print printf ("................ "); also need to be translated into machine language, called compile. A sentence in advanced language usually corresponds to multiple machine commands.

Question 2: Main Classification of advanced languages.

Mainly divided into object-oriented and process-oriented. C is process-oriented and c ++ Is Object-Oriented.

Question 3: Brief History of C Language

1973 Bell lab invented c and revised unix. 1983 to produce a standard, 1989 to a standard, and 1999 to a standard.

Question 4: Why do I add # include <stdio. h>

C language does not provide input and output statements, Memory Operation statements, and so on. These are implemented by the library functions provided by the compilation system.

# Include <stdio. h> indicates to find the stdio. h file from the subdirectory of the c compilation system and include it, so that the corresponding Input and Output statements can be called.

Question 5: Why C language is often used to compile system software.

Most functions of assembly can be implemented, and physical addresses can be accessed directly.

Question 6: The simplest main function and why?

Int main ()

{

Return 0;

}
Int is recommended for c99. It is certainly designed in this way during design. If 0 is returned, it indicates success. If the success is the same, if not 0 is returned, it indicates failure. There may be many reasons for failure, for example, 1 is returned, returns-1 and 2, which is the design idea.

 

Question 7: Why do I declare a function?

Directly compile the following code and report the c3861 error identifier not found.

Method 1 removes comments from the declaration; method 2 advances the definition;

Similarly,

# Include <stdio. h>
Int main ()
{
Printf ("Please input two numbers, seperated by space \ n ");
Int a, B;
// Int myMax (int num1, int num2 );//
Scanf ("% d", & a, & B );
Int c = myMax (a, B );
Printf ("the max number between % d and % d is % d", a, B, c );
Return 0;
}
Int myMax (int num1, int num2)
{
Int maxNum;
MaxNum = num1> = num2? Num1: num2;
Return maxNum;
}

Question 8: why is there a link to this step?
. C source file compilation to generate binary. obj file, but cannot be executed, different. file c generates its own. obj, You need to link all obj files to an exe file. Even a source file needs to be linked to the library of the compilation system.

Question 9 What constants are there?
(1) The simplest constant is a number, for example, 1, 55, 50.2, 78.34e4, 43.22E3.
(2) character constants: the common characters '1', 'A', '4', '\ n' are only image characters in the shape of a number 4, the representation is ASCII code, with no character '44 '. '\ 033' or' \ x1B 'indicates a character with an ASCII code of 27, that is, the ESC controller.
(3) String constant: "hello world"
(4) # define PI 3.1415926

Question 10 # What is the difference between define PI 3.1415926 and const double PI = 3.1415926?
One is a variable, the other is a symbolic constant, the other occupies memory, and the other does not occupy memory. The other has a type, one has no type, one has always existed, and the other is replaced by a pre-compiled symbol.

From: column of drbinzhao

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.