C Language Learning FAQ

Source: Internet
Author: User

The most confusing problem for beginners is that they can understand the lessons and examples in the books, but they do not know how to start programming by themselves. There are three reasons for this:

1. The so-called understanding and understanding are just superficial grammar knowledge.ProgramOr the software should control the process of the program according to the actual needs to solve the problem. If you do not have a deep understanding of the execution process (or process) of the C language statements ), how do you write programs to solve these practical problems?
2. Using C language programming to solve practical problems requires not only C language programming knowledge, but also relevant professional knowledge. For example, if you do not know the rectangle area formula, even if the C language is good, you cannot compile a program to find the rectangle area.
3C language programming is a very practical course. It is difficult to learn C language without practicing the "paper discussion" Optical program. For example, if you have never been riding a bicycle and have listened to the coach to explain related knowledge, rules, and skills, don't say you can't even perform on stage or on the road.

Step 1: Verify the exercise

In this step, you need to input the program as is based on the program instance on the teaching material and run the program correctly. In this step, you can master how to use C Programming Software (including creating, opening, saving, and closing C programs, and skillfully entering and editing C Programs; initially remember the knowledge points of the new chapter and develop a good C programming style ). Click here to view [C programming style]

By using the Turbo C/C ++ for Windows Integrated Experiment and learning environment software, you can easily look at the Software Integrated C language getting started tutorial and input the program examples in the exercise. For more information, see the software help section.

The easiest mistake for beginners is:
1. There is no distinction between numbers 1 and letters l, letters O and numbers 0 in the teaching material, resulting in an undefined variable error. Another easy-to-error point is to enter commas (,), semicolons (;), double quotation marks () in English as commas (,) and parentheses () in Chinese (), the double quotation mark "" causes invalid characters.
2. Beginners of C language are prone to syntax errors: the use of undefined variables, identifiers (variables, constants, arrays, functions, etc.) are case insensitive and missing "; "," {"and"} "," ("and") "do not match, control statements (selection, branch, loop) the format is incorrect. The library function does not contain the corresponding header file, the undeclared custom function is called, The Real-participation parameter does not match when the function is called, and the boundary of the array is exceeded.
3. When modifying C syntax errors, pay attention to the following two points:
(1) because the C language syntax is relatively free and flexible, the error information is not particularly accurate. For example, if no error is found in row 10th when row 10th is prompted, search for the error from row 10th and modify it.

(2) A statement error may produce several error messages. If this error is modified, other errors will disappear. Note: Generally, the first error message best reflects the location and type of the error. Therefore, when debugging a program, you must modify the information according to the first error message. After modification, run the program immediately, if there are still many errors, You need to modify them one by one, that is, you need to run the program every time you modify an error.

Step 2.
Based on the C program entered in step 1, perform a pilot modification. Run the program to check the changes in the program results, analyze the reasons for the changes, and deepen the understanding of new knowledge points. In fact, this is in sync with the first step, to achieve "input" to deepen the memory of knowledge, "modify" to deepen the understanding of knowledge. Memory and understanding complement each other and promote each other.

For example, convert the simplest Hello world! Program
# Include "stdio. H"
Int main ()
{
Printf ("Hello world! \ N ");
Return 0;
}
In

Printf ("Hello world! \ N ");

Hello world! Change your name and run the program. What changes do you see?

For example, find the sum of 1 + 2 + 3... + 100.

# Include <stdio. h>
Main ()
{
Int I, sum = 0;
For (I = 1; I <= 100; I ++)
{
Sum = sum + I;
}
Printf ("sum = % d \ n", sum );
}

1st times, change 100 in for (I = 1; I <= 100; I ++) to 50, run the program, and see what changes are there?
For 2nd times, change I ++ in for (I = 1; I <= 100; I ++) to I = I + 2. Run the program and see what changes have taken place?
Find out the reasons for the changes in the program results, and deepen the understanding of the C statement.

 

Step 3: Try a similar problem on your own.
In this step, you do not need to read the teaching materials. Even if the program cannot be run, you can check whether it can be corrected to make it run correctly. The objective is to further strengthen the memory and understanding of the previous two steps.

Compare the previous two steps to design some of the same issues, try to program on your own, then debug, and then gradually expand, add program lines, and add some auxiliary functions.

Step 4: Enhance the program debugging capability
In each chapter of the Integrated Experiment and learning environment for Turbo C/C ++ for Windows, errors that are easy for beginners of C language are displayed, change the correct program in the teaching material to the wrong program, run the program, view the error message prompts, write down the error information, change the program to the correct one, and run the program. In this way, you can learn the causes of errors in the C language program and the ability to modify errors.
Note: Only one error can be corrected at a time. The purpose is to display the real cause of the Error. Avoid modifying multiple places at a time and find out the real cause of the error. Remember !!!!
Note: When debugging a program on the machine, you must bring a recording book, write down the English error prompt information and methods to solve the problem, and accumulate program debugging experience to avoid making the same mistake in programming, remember !!!!.
For example
Printf ("Hello world! \ N "); into a Chinese semicolon;

Run the program to see what results?

The format of the C language error message: (The following example is the turobo c2.0 error message, 1)

Error file name row number colon error content

Too many other users

Error E: \ wintc \ frist. C 5: function call Missing) in function main

The format of the error message in C language: (the following example shows the error message in Visual C ++ 6.0, 2)

The row number of the file name has a colon error.CodeColon error content

There are already too many other

E: \ wintc \ frist. C (5): Error c2143: syntax error: Missing ') 'before ';'

The software integrates the two most popular compilers visual c ++ 6.0 and Turbo C 2.0, supports editing, compilation, and debugging of C, C ++, C ++, and Windows C Programs. The software intelligently selects the compiler based on the type of the user input program without user interference.

Debugging is a very practical task. It is useless to talk about the program on paper. Just like a swimmer can never learn to swim if he only listens to the coach for demonstration and does not practice in the water.
Even if a good programmer writes a program, he may make mistakes and make the lowest possible syntactic errors. However, he can quickly find and correct the errors, and the C language beginners face the error prompts, I don't know what is wrong, but how to correct it is the difference.

Step 5: study typical C language programs to improve the programming capability

After learning the above process, we have learned the process of various C language statements (that is, how the computer executes these statements), and then we can study the typical C language program written by others, understand how others solve the problem, learn how to solve the problem and program design skills, and improve their programming skills.

There are more than 50 typical source programs in the software, study its implementation methods, and improve their programming capabilities.

Step 6: Study the curriculum design source in sequence to improve the C language programming ability and the ability to debug large programs.

The objective of the C language curriculum design is to allow students to take full advantage of the learned C language knowledge to solve some practical problems and improve the program design and debugging capabilities, it lays a solid foundation for further software development.
The software has four annotated detailed course design source programs
This is an introduction to the C language tutorial from the Integrated Experiment and learning environment for Turbo C/C ++ for Windows.

C language learning?
C language learning? Beginners often ask this question. The answer is simple. If you are interested in the C language and have a strong desire to learn, you can easily learn it. If you are not interested, you cannot learn simple knowledge.
How many schools teach students to play games? The answer is no, but many students often play games and often share their experiences.
If you are interested in the C language, why don't you use the C language learning experience of playing games? In this case, is the C language hard to learn?
Finally, I would like to share with beginners the C language: first, believe that you have the ability to learn C language well, and then show this ability at any cost, and you will succeed. Why not do anything like this?

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.