Text Editor
Windows:turboc, dev-c++
Linux:vim, Emacs (Vim is the Mac system comes with, it is also the text editor used today)
Vim
• Create Files (completed in terminal)
Vim printname.c(. C is the mark of the C language at the end)
There are two modes of VIM: Command mode & Edit mode
Enter I (a) in command mode to enter edit mode (the flag for edit mode is to display "INSERT" below the editor)
(Mode of operation in previous article)
(P.S. " #include "Import the header file of your own definition or system," STD "is standard," I "is input and" O "is output. The int before main is a fixed notation and is a return value. Main is a function name, which is the entry point for each program. "ARGC", "argv" is the parameter of main, "ARGC" the number of arguments passed over when "run", "argv" saves the parameter as a string in the array. If you want to see the exact meaning of these two parameters, you can use "printf" to view them. "printf" is an output instruction. "return = 0" means that the program is executing to the end, when "return = 1" is, indicating that the program is running in an unexpected error, at this time the system will forfeit all the memory resources requested by the program and will immediately terminal program execution. The default must have a return value, but in c++98, if there is no return value, the compiler automatically adds "return = 0". )
· All the steps required to run a program
1. precompilation: Speak # include header file expansion (the suffix of the header file is ". h")
GCC-E pritname.c (at this point the file still ends in. c)
2. Assembly: Generate assembly code, which produces a. s file. Also determine if the code is correct.
Gcc-s printname.c
3. Compile: Convert the assembly code into a target file (binary file), producing a. o file.
Gcc-c PRINTNAME.S
4. Link to link all the . o files to each executed file (can be named for the executable file)
Gcc-o outputname PRINTNAME.O XX.O
5. Running
./outputname
But such a process is complex, so with the IDE (integrated development Environment), windows:vc++6.0, Visual Studio; Macos:xcode.
Xcode
This includes system development for all Apple products (Ios,tvos,watchos,os x,other). Very powerful! You can write code "split screen".
Single-line Comment
/*
Multi-line comments
*/
It is important to note that "/*" in a multiline comment matches the next "*/", so you cannot embed a multiline comment in a multiline comment.
Common shortcut keys
(P.S. In this blog editor can also use the above shortcut keys, you can deepen the impression.) )
Variable
This is a picture I found on the Internet. A variable is an item, and the object is stored in a space, and the space is determined by the data type. For example, this picture below.
The number that converts a decimal number to n is a short division, and the conversion result is the remainder of the inverted write. ' A ' represents the character, "a" represents a string , and when "%c" is replaced with "%d", the output value corresponds to its ASCII value . In the picture, "%d", "%ld", "%c", "%f" are placeholders .
Supplemental scanf
scanf is an input instruction that is separated by a "space" when entering multiple instructions. For this example, when you enter two variables, the program will not run until you enter a third variable. However, when you enter four variables, only the first three variables are recognized, because the fourth variable has no "position".
18:47:29
2015.12.01 VIM Writing program run steps Xcode basic Introduction (accelerator) variables in C language