[Note] Introduction to post-reading and position of C language university practical tutorial

Source: Internet
Author: User

For more information about the bibliography, see:C language university practical tutorial/21st century university computer series teaching materials

1. What is the concept of concatenation of operators?
M =-N ++; // when n = 3, M = _? _; Verify it yourself!

2. TestProgramIt can only prove that the program is wrong, but it cannot prove that the program is not wrong.
When the project manager asks programmers, "When can the bug be repaired ?" "I am useless. I asked you to ask this question !" -- This is the truth.

3. incremental Testing
It is also called"Exploration test "?

The efficiency of testing personnel establishment is often affected by previous testing results. This method, called the discovery testing, is the first step in determining how to test it.
Exploring applications and familiarizing yourself with the functions of applications is a necessary step in the learning process. Testers must be familiar with the application before starting any tests. This kind of exploration can take multiple forms:
1. Learn existing test guides or training materials;
2. Read any existing end user or engineering documents;
3. Ask professionals to demonstrate the application;
4. Enter random data and commands;
5. Execute all operation options;
6. Curious and curious to try the running state of the program.
In the process of exploration, the tester observes how the program works by observing the program's behavior, and feels that the input is good and the input is not good. When the display result of the application is different from the expected result of the tester, there may be potential problems.
The purpose of the exploration is to learn more about the application through the operation of application functions. This is only one aspect of the test method. As long as you create a new test based on observation when executing the current test, you are using the exploration test method.
Another important task of exploration is to find someone who understands the application and has the right to clarify the needs.

Non-incremental test

4. The assert header file <assert. h> is good. In the future, encoding is a custom function. This check must be used to check the validity of the parameter and determine the return value of the function.

5. Add the extern keyword to the declaration of global variables in the header file.

6. Two-dimensional arrays and the above transfer is required, as shown in [] [x] [x]...

7. The last element in the character's one-dimensional array is '\ 0.

8. Pass a single value → pass a real parameter to the form parameter

9. Think about row pointers and column pointers. It is easier to think about using matrices. I did not pay attention to it.

10. Return struct

11. Bit segments are interesting and memory saving. See the following figure.

I have previously introduced that the access to information in memory is generally in bytes. In fact, sometimes you do not need to use one or more bytes to store a piece of information. For example, "true" or "false" is represented by 0 or 1, and only one bit is required. When a computer is used in the field of process control, parameter detection, or data communication, the control information usually occupies only one or several binary places in one byte, and usually contains several pieces of information in one byte. So how can we assign values to one or more binary places in a byte and change its values?
The C language allows a struct to specify the Memory Length occupied by its members in units of bits. This bit-based member is called a bit segment or a bit field ). The bit segment can store data with a small number of digits. Example: struct packed-data {unsigned A: 2; unsigned B: 6; unsigned C: 4; unsigned D: 4; int I;} data; a, B, C, and D are two, six, four, and four, respectively. I is an integer. 4 bytes in total. It can also make the bit segments not exactly occupy one byte. For example, struct packed-data {unsigned A: 2; unsigned B: 3; unsigned C: 4; int I ;}; struct packed-data; among them, A, B, and C account for 9 digits, more than 1 byte, less than 2 bytes. It is followed by an int type, which occupies 2 bytes. Seven spaces after A, B, and C are idle, and I is stored from the beginning of the other byte. Note that the direction of space allocation in the middle segment of the storage unit varies with machines. In the C system used by the microcomputer, it is usually allocated from right to left. However, you do not have to ask such details. The method used to reference data in the position. For example, data. A = 2; data. B = 7; data. c = 9; pay attention to the maximum allowed range of bit segments. If data. A = 8; is written, the error occurs. Because data. A only occupies 2 places and the maximum value is 3. In this case, the minimum value assigned to the number is automatically obtained. For example, if the binary number of 8 is 1000, and data. A has only two digits, the value of data. A is 0 because the binary number of 1000 is 2 digits lower. The definition and reference of bit segments must be described as follows: (1) the type of bit segment members must be specified as unsigned or Int. (2) If a segment is to be stored from another word. It can be defined in the following form: Unsigned A: 1; unsigned B: 2; (a storage unit)
Unsigned: 0; unsigned C: 3; (another storage unit)
Originally, A, B, and C should be stored in a storage unit (Word) consecutively. Because a bit segment with a length of 0 is used, its function is to store the next bit segment from the next storage unit. Therefore, only a and B are stored in one unit, and C is stored in the next unit. (The above "storage unit" may be one byte, but may be 29 bytes, depending on different compilation systems .) (3) A single segment must be stored in the same storage unit and cannot be stored across two units. If the first unit space cannot accommodate the next segment, the space does not need to be used, instead it will be stored from the next unit. (4) An anonymous field can be defined. For example: Unsigned A: 1; unsigned: 2; (these two spaces are not used) unsigned B: 3; unsigned C: 4; there is an unknown segment behind a, and this space is not used. (5) The length of the bit segment cannot be greater than the length of the storage unit or the bit segment array cannot be defined. (6) Bit segments can be output in integer format. For example: printf ("% d, % d, % d", Data. a, Data. b, Data. c); of course, you can also use % u, % O, % x, and other formats to output data. (7) The bitwise segment can be referenced in a numerical expression. It is automatically converted into an integer by the system. For example, data. A + 5/data. B is legal. [Thank you for your reference]
1. incremental sequence Partitioning Method-exploration test
2. Non-incremental Testing
3. Bit segments

 

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.