C language quick start tutorial (1)
C language Overview (development preparation)
This section describes the road map:
Ps: Mark 3 is not very important. You just need to know it. Mark 1 is very important and requires proficiency!
1. Overview of C language: 1.1 what is the relationship between computer and programming language?
A: computers are composed of hardware and software systems. Hardware ----> material basis; Software -----> soul;
If you leave the software, the computer is a bare metal machine that can't do anything;
It can visually compare the human brain and body!
1.2 update of programming languages:
1.3 features of c Language
1.4 simplest HelloWorld Program
This is the first program in C language. The first program in many programming languages is usually hello world!
Security is not required here, because I learned some knowledge points later! It's time to write it several times! Wait until you finish learning and look back at hello world
You will have a deeper understanding!
Code:
/* This Code demonstrates the simplest C program author: Coder-pig */# include
// The Preprocessing operation tells the compiler to include the standard input/output header file in the program. // The following calls the printf () output function int main () // main function, there is only one entry to the C language program !!! {// The left braces indicate the start of the function printf ("Hello world! \ N "); // call the output function print () function to print Hello world! // Here \ n is an escape character, and the function is to wrap the return 0; // usually at the end of the main () function, return 0 to indicate that the main () function ends normally}
From the simplest Hello world Program, we know that the C program has the following features:
① C language programs are composed of preprocessing commands and functions. Preprocessing command sets are usually located at the beginning of the file!
② A function is an integral part of a C language program. There can be multiple functions, but there is only one main () function! Also called the main function!
③ Semicolon; indicates the end of a statement!
④ To increase the readability of your program, add comments to the code! The following two methods are used:/**/multi-line comment and // single-line comment.
Note: writing comments is not just for others, but the current code may be relatively small. When there are thousands of lines of code, there are no comments, and the whole code is like a paste!
You will scold the person who wrote the code at the time... It may take more time to read the code than to re-write the code,
Not worth the candle! So for you and the people who read your code, write more comments to read the code. It is not easy to read the code, and note and cherish it! Second (second) Second
1.5 program compilation and running
Speaking of program compilation and running, we must first talk about the compiler. We use the necessary VC ++ 6.0 for beginners.
Of course, you can also use other compilers such as visual studio. You can also use Turbo C, which is quite old;
Some code on the Internet, such as the Code of a colorful snake, must be run by Turbo C, because Turbo C has a graphics library graphic. h.
So don't count on using VC ++ 6.0 to run your greedy snake...
C language program conversion process:
The procedure of Using VC ++ 6.0:
① Click the vc ++ 6.0 icon to go To the encoding page:
② Click a file to create a file. The following dialog box is displayed.
③ Write code:
④ After the code is written, it is necessary to compile and run it.
Click the two buttons in the menu bar one by one:
Ps: the two corresponding shortcuts are ctrl + f7 and crtl + f5. I don't tell him, o (character □character) o
⑤ It cannot be run here because we have an error. When we click compile, the following console will display the error:
This shows that the program has an error with 0 warnings. If there is an error, it cannot be run. If there is a warning, it can be run again!
Scroll up the scroll wheel to find the error message.
This sentence is quite clear. We also know that the semicolon is missing. Double-click this line and you will be able to see where the code goes wrong. Just add the semicolon after the statement that misses the semicolon!
6. Compile again, prompting no errors or warnings. Click the run button to bring up the output result window (console)
Download:
Vc 6.0 complete Green Edition: http://pan.baidu.com/s/1hq3Otvu
Simple video of vc 6.0 complete Green Edition:Http://pan.baidu.com/s/1c01oCSS
Common Errors for beginners:Http://pan.baidu.com/s/1eQtdfWY
Homework after class:Http://pan.baidu.com/s/1o6Lngtc