China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-24 14:19
中国DOS联盟论坛 » 网络日志(Blog) » C language (four characters) http://www.shucunwang.com/RunCode/c/ View 23,750 Replies 75
Original Poster Posted 2016-06-25 20:09 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
http://www.shucunwang.com/RunCode/c/

http://codepad.org/TIbKemXJ

http://www.manonggu.com/biancheng/
C Language Resource Collection in Chinese Version
https://github.com/jobbole/awesome-c-cn

【Raw】Compare C Language and Machine Language (English, for reference)
https://www.bilibili.com/video/av11237858

Yingsi Teaching Network (C language content mainly based on Turbo C)
http://www.winyes.com/

Bilibili C Language
https://www.bilibili.com/video/av9430200/?from=search&seid=8131884833781373784

Sogou Turbo C Chinese Version Download (Use the localized version in the run wizard, run the program in virtual machine mode)
http://xiazai.sogou.com/detail/34/16/902784868571182432.html?uID=440DBA3D4F0A900A00000000598FB273

C Language
Locked

Synonym C (computer language) generally refers to C language
This entry is reviewed by the "Science Popularization China" Encyclopedia Science Entry Writing and Application Project.
C language is a general-purpose computer programming language with wide applications. The design goal of C language is to provide a programming language that can be compiled easily, handle low-level memory, generate a small amount of machine code, and can run without any runtime environment support.
Although C language provides many low-level processing functions, it still maintains good cross-platform characteristics. A C language program written according to a standard specification can be compiled on many computer platforms, even including some embedded processors (microcontrollers or MCUs) and supercomputer operating platforms.
In the 1980s, in order to avoid differences in the C language syntax used by various developers, the American National Standards Institute formulated a complete international standard syntax for C language, called ANSI C, as the initial standard of C language.

Chinese Name
C Language
English Name
The C Programming Language
Category
Computer Programming Language
Founder
Dennis MacAlistair Ritchie

Founding Time
1972
Originated From
BCPL Language
Main Compilers
Clang, GCC, MSVC, Turbo C, etc.
Inspired Languages
B Language, Assembly, ALGOL68
Operating System
Multi-platform

Table of Contents

1. Development History
2. Programming and Development
▪ Compiler
▪ Integrated Development Environment (IDE)
▪ Hello World
3. Language Standards

▪ K&R C
▪ ANSI C / C89 Standard
▪ C99 Standard
▪ C11 Standard
4. Language Features
▪ Basic Characteristics

▪ Unique Features
▪ Advantages and Disadvantages
▪ New Features of C11
5. Language Components
▪ Basic Composition
▪ Keywords

▪ Syntax Structure
▪ Program Structure
▪ Function
▪ Operators
6. Classic Errors

Development History
The reason why C language is named C is that C language originated from the B language invented by Ken Thompson, and the B language originated from the BCPL language.
In 1967, Martin Richards from Cambridge University simplified the CPL language, thus producing the BCPL (Basic Combined Programming Language) language.
C Language Promotion Image C Language Promotion Image
In the 1960s, Ken Thompson, a researcher from Bell Laboratories of AT&T (AT&T Bell Laboratory) in the United States, was idle and itchy, wanting to play an electronic game he made himself, Space Travel. He found an idle machine, PDP-7, behind his boss. But this machine had no operating system, and the game had to use some functions of the operating system, so he started to develop an operating system for PDP-7. Later, this operating system was named - UNIX.
In 1970, Ken Thompson from Bell Laboratories in the United States, based on the BCPL language, designed a very simple and hardware-closer B language (taking the first letter of BCPL). And he wrote the first UNIX operating system in B language.
In 1971, Dennis M. Ritchie, who also loved Space Travel, joined Thompson's development project to cooperate in the development of UNIX in order to play the game earlier. His main job was to transform the B language to make it more mature.
In 1972, D.M. Ritchie from Bell Laboratories in the United States finally designed a new language based on the B language. He took the second letter of BCPL as the name of this language, which is the C language.
At the beginning of 1973, the main body of the C language was completed. Thompson and Ritchie couldn't wait to rewrite UNIX completely with it. At this time, the fun of programming made them completely forget that "Space Travel" and devoted themselves wholeheartedly to the development of UNIX and C language. With the development of UNIX, the C language itself is also constantly improving. Until today, various versions of UNIX kernels and surrounding tools still use C language as the most important development language, and many of them still inherit the code from Thompson and Ritchie.
During the development, they also considered porting UNIX to other types of computers. The strong portability (Portability) of the C language is manifested here. Both machine language and assembly language are not portable. A program developed for x86 cannot run on machines such as Alpha, SPARC, and ARM. The C language program can be used on processors of any architecture, as long as the processor of that architecture has a corresponding C language compiler and library, and then the C source code is compiled and linked into a target binary file to run.
In 1977, Dennis M. Ritchie published the C language compilation text "Portable C Language Compiler" that is not dependent on a specific machine system.
The C language continued to develop. In 1982, many knowledgeable people and the American National Standards Institute decided to establish a C standard committee to establish the standard of the C language in order to make this language develop healthily. The committee is composed of hardware manufacturers, compiler and other software tool manufacturers, software designers, consultants, academic people, C language authors, and application programmers. In 1989, ANSI released the first complete C language standard - ANSI X3.159-1989, referred to as "C89", but people are also used to calling it "ANSI C". C89 was adopted unchanged by the International Organization for Standardization (ISO) in 1990. The official name given by ISO is: ISO/IEC 9899, so ISO/IEC9899: 1990 is also usually referred to as "C90" for short. In 1999, after making some necessary corrections and improvements, ISO released a new C language standard, named ISO/IEC 9899: 1999, referred to as "C99". On December 8, 2011, ISO officially released a new standard, called ISO/IEC9899: 2011, referred to as "C11".
Programming and Development
Compiler
GCC, an open-source and free compiler developed by the GNU organization
MinGW, GCC under the Windows operating system
Clang, an open-source BSD-licensed compiler based on LLVM
Visual C++ :: cl.exe, the compiler built into Microsoft VC++
Integrated Development Environment (IDE)
CodeBlocks, an open-source and free C/C++ IDE
CodeLite, an open-source, cross-platform C/C++ integrated development environment
Orwell Dev-C++, a portable C/C++ IDE
C-Free
Light Table
Visual Stdio series
Hello World
The following is a simple program that prints the string "Hello, world!" on the standard output device (stdout). A similar program is usually the first program when learning a programming language:
1
2
3
4
5
6
7

#include <stdio.h>

int main(void)
{
printf("Hello, world!");
return 0;
}
Language Standards
K&R C
At first, there was no official standard for the C language. In 1978, it was officially published by Bell Laboratories of AT&T (AT&T). Brian Kernighan and Dennis Ritchie published a book called "The C Programming Language". This book is called K&R by C language developers and has been regarded as an informal standard description of the C language for many years. People call this version of the C language K&R C.
K&R C mainly introduces the following features:
Struct (struct) type
Long integer (long int) type
Unsigned integer (unsigned int) type
Change the operators =+ and =- to += and -=. Because =+ and =- will make the compiler not know whether the user wants to handle i = -10 or i =- 10, causing confusion in processing.
Even many years after the ANSI C standard was proposed, K&R C is still the most accurate requirement of many compilers, and many old compilers still run the K&R C standard.
ANSI C / C89 Standard
From the 1970s to the 1980s, the C language was widely used, from large mainframes to small microcomputers, and many different versions of the C language also derived.
In 1983, the American National Standards Institute (ANSI) established a committee X3J11 to formulate the C language standard.
In 1989, the American National Standards Institute (ANSI) passed the C language standard, which is called ANSI X3.159-1989 "Programming Language C". Because this standard was passed in 1989, it is generally referred to as the C89 standard. Some people also refer to it as ANSI C because this standard was released by the American National Standards Institute (ANSI).
In 1990, the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC) set the C89 standard as the international standard of the C language, named ISO/IEC 9899:1990 - Programming languages -- C . Because this standard was released in 1990, some people simply call it the C90 standard. However, most people still call it the C89 standard because this standard is completely equivalent to the ANSI C89 standard.
In 1994, the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC) released a revised version of the C89 standard, named ISO/IEC 9899:1990/Cor 1:1994 , some people simply call it the C94 standard.
In 1995, the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC) released another revised version of the C89 standard, named ISO/IEC 9899:1990/Amd 1:1995 - C Integrity , some people simply call it the C95 standard.
C99 Standard
In January 1999, the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC) released a new standard for the C language, named ISO/IEC 9899:1999 - Programming languages -- C , referred to as the C99 standard. This is the second official standard of the C language.
The features included in C99 are:

Increased restrictions on the compiler, such as each line of the source program requiring at least 4095 bytes of support, and variable names and function names requiring 63 bytes of support (extern requires 31 bytes of support).
Enhanced preprocessing functions. For example:
Macro supports taking variable arguments #define Macro(...) __VA_ARGS__
When using a macro, it is allowed to omit parameters, and the omitted parameters will be expanded into empty strings.
Supports single-line comments starting with // (this feature has actually been supported by many compilers of C89).
Added new keywords restrict, inline, _Complex, _Imaginary, _Bool
Supports types such as long long, long double _Complex, float _Complex, etc.
Supports variable-length arrays, that is, the array length can be determined at runtime, such as using variables as array lengths. Declare in the form of int a. However, considering efficiency and implementation, variable-length arrays cannot be used globally, or in structs and unions.
Variable declarations do not have to be placed at the beginning of the statement block. The for statement is recommended to be written as for(int i=0;i<100;++i), that is, i is only valid within the for statement block.
Allows the use of (type_name){xx,xx,xx} similar to the constructor form of C++ to construct anonymous structs.
Compound literals: When initializing a structure, it is allowed to assign values to specific elements, in the form:
struct test{int a,b;} foo = { .a = {1}, .a = 2 };
struct test{int a, b, c, d;} foo = { .a = 1, .c = 3, 4, .b = 5 }; // 3,4 are assignments to .c,.d

In the format string, \u is used to support unicode characters.
Supports the description of hexadecimal floating-point numbers.
The format strings of printf scanf have added support for the long long int type.
The internal data description of floating-point numbers supports the new standard, and the #pragma compiler directive can be used to specify it.
In addition to the existing __line__ __file__, __func__ is added to get the current function name.
Allows the compiler to simplify non-constant expressions.
Modified the definition of /% processing negative numbers, so that a clear result can be given. For example, in C89, -22 / 7 = -3, -22% 7 = -1, and also -22 / 7= -4, -22% 7 = 6. In C99, it is clearly -22 / 7 = -3, -22% 7 = -1, only one result.
Cancelled the regulation that the function return type is int by default.
Allows the last array in the struct definition to not specify its length, written as (flexible array member).
const const int i will be treated as const int i.
Added and modified some standard header files, such as <stdbool.h> defining bool, <inttypes.h> defining int of some standard lengths, <complex.h> defining complex numbers, <wctype.h> defining wide characters, <tgmath.h> similar to generic mathematical functions, <fenv.h> related to floating-point numbers. va_copy is added in <stdarg.h> for copying ... parameters. struct tmx is added, and struct tm is extended.
Input and output support corresponding to wide characters and long integers, etc.
Most features of C99 are supported by GCC and other commercial compilers.

C11 Standard

On December 8, 2011, the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC) released a new standard for the C language again, named ISO/IEC 9899:2011 - Information technology -- Programming languages -- C , referred to as the C11 standard, formerly known as C1X. This is the third official standard of the C language and also the latest standard of the C language.
The new standard improves compatibility with C++ and adds some new features. These new features include:
Standardization of alignment processing (including _Alignas identifier, alignof operator, aligned_alloc function, and <stdalign.h> header file.
_Noreturn function mark, similar to gcc's __attribute__((noreturn)).
_Generic keyword.
Multithreading support, including:
_Thread_local storage type identifier, <threads.h> header file, which contains functions for thread creation and management.
_Atomic type modifier and <stdatomic.h> header file.
Enhanced Unicode support. Based on the C Unicode technical report ISO/IEC TR 19769:2004, enhanced support for Unicode. Including adding char16_t and char32_t data types for UTF-16/UTF-32 encoding, and providing the <uchar.h> header file containing Unicode string conversion functions.
The gets() function is deleted, and a new safer function gets_s() is used instead.
Added boundary check function interfaces and defined new safe functions, such as fopen_s(), strcat_s(), etc.
Added more floating-point processing macros.
Anonymous struct/union support. This has long existed in gcc, and C11 introduces it into the standard.
Static assertions (static assertions), _Static_assert(), which are processed after interpreting #if and #error.
New fopen() mode, ("…x"). Similar to O_CREAT|O_EXCL in POSIX, it is commonly used in file locks.
Added quick_exit() function as a third way to terminate the program. When exit() fails, the least cleaning work can be done.

Language Features

Basic Characteristics

C++ Language Code C++ Language Code
1. High-level language: It is a working unit that combines the basic structures and statements of high-level languages with the practicality of low-level languages.
2. Structured language: The prominent feature of structured language is the separation of code and data, that is, each part of the program is independent except for necessary information exchange. This structured method can make the program hierarchical, easy to use, maintain, and debug. The C language is provided to users in the form of functions, which can be easily called, and has various loops and conditional statements to control the program flow, so that the program is completely structured.
4. Code-level cross-platform: Due to the existence of the standard, almost the same C code can be used for multiple operating systems, such as Windows, DOS, UNIX, etc.; it is also suitable for multiple machine types. The C language is superior to other high-level languages for occasions that need to perform hardware operations.
5. Using pointers: You can directly perform operations close to the hardware, but the pointer operation of C is not protected, which also brings many unsafe factors. C++ has made improvements in this regard. While retaining pointer operations, it has enhanced security, which is supported by some users. However, because these improvements increase the complexity of the language, it is also criticized by another part. Java has learned from the lessons of C++, canceled pointer operations, and also canceled some controversial places in C++ improvements, achieving good results in security and suitability, but its own interpretation runs in the virtual machine, and the running efficiency is lower than C++/C. Generally speaking, C, C++, and java are regarded as languages of the same series, and they have long occupied the top three in the program usage list.

Unique Features

The C language is a procedural language with structured program design, variable scope (variable scope), and recursion function.
The C language passes parameters by value (pass by value), and also can pass pointers (a pointer passed by value).
Different variable types can be combined with structs.
There are only 32 reserved words (reserved keywords), which makes variable and function naming more flexible.
Some variable types can be converted, such as integer and character type variables.
Through pointers, the C language can easily perform low-level control of memory.
The preprocessor makes the compilation of the C language more flexible.

Advantages and Disadvantages

Advantages
1. Concise, compact, flexible and convenient
The C language has only 32 keywords and 9 control statements. The program writing form is free and case-sensitive. Combine the basic structures and statements of high-level languages with the practicality of low-level languages. The C language can operate on bits, bytes, and addresses like assembly language, and these three are the most basic working units of the computer.
C Language's Hello World Program C Language's Hello World Program
2. Rich operators
The operators of the C language cover a wide range, with a total of 34 operators. The C language treats parentheses, assignment, forced type conversion, etc. as operators. Thereby making the operation types of the C language extremely rich and the expression types diversified. Flexibly using various operators can realize operations that are difficult to implement in other high-level languages.
3. Rich data types
The data types of the C language include: integer type, real type, character type, array type, pointer type, structure type, union type, etc. It can be used to implement operations of various complex data structures. And the pointer concept is introduced, which makes the program more efficient.
4. Flexible and practical expression methods
The C language provides a variety of operators and methods for the value of expressions. The expression of the problem can be obtained through various ways, and its program design is more active and flexible. Its syntax restrictions are not too strict, and the program design freedom is large. For example, integer types, character types, and logical types can be used universally.
5. Allowing direct access to physical addresses and operating hardware
Because the C language allows direct access to physical addresses and can directly operate on hardware, it has both the functions of high-level languages and many functions of low-level languages. It can operate on bits (bit), bytes, and addresses like assembly language, and these three are the most basic working units of the computer, which can be used to write system software.
6. High quality of generated object code and high efficiency of program execution
The C language describes the problem more quickly than assembly language, with less workload and better readability, easy to debug, modify and port, and the code quality is equivalent to that of assembly language. The C language is generally only 10% to 20% less efficient than the object code generated by the assembly program.
7. Good portability
The C language compilation programs on different machines have 86% of the code in common, so the C language compilation program is easy to port. A program written in C language in one environment can be ported to run in a completely different environment with little or no modification.
8. Strong expressive power
The C language has rich data structures and operators. It contains various data structures, such as integer types, array types, pointer types, and union types, to implement operations of various data structures. The C language has 34 operators, with a wide range. Flexibly using various operators can implement extremely difficult operations.
The C language can directly access the physical address of hardware and can perform bit (bit) operations. It has many advantages of both high-level languages and low-level languages.
It can be used to write both system software and application software, and has become a general-purpose programming language.
In addition, the C language has powerful graphics functions and supports multiple displays and drivers. And it has powerful calculation functions and logical judgment functions.
  
Disadvantages
1. The main disadvantage of the C language is reflected in the encapsulation of data. This makes the C language have great defects in data security, which is also a big difference between C and C++.
2. The syntax restrictions of the C language are not very strict, and the type constraints on variables are not strict, which affects the security of the program, and does not check for array subscript out of bounds, etc. From an application perspective, the C language is more difficult to master than other high-level languages. That is to say, for people using the C language, more proficient programming is required.

New Features of C11

1. Standardization of alignment processing (including _Alignas identifier, alignof operator, aligned_alloc function, and <stdalign.h> header file).
2. _Noreturn function mark, similar to gcc's __attribute__(noreturn).
3. _Generic keyword.
4. Multithreading support, including: _Thread_local storage type identifier, <threads.h>; header file, which contains functions for thread creation and management.
5. Enhanced Unicode support, based on the C Unicode technical report ISO/IEC TR 19769:2004, enhanced support for Unicode. Including adding char16_t and char32_t data types for UTF-16/UTF-32 encoding, and providing the <uchar.h> header file containing Unicode string conversion functions.
6. The gets() function is deleted, and a new safer function gets_s() is used instead.
7. Added boundary check function interfaces and defined new safe functions, such as fopen_s(), strcat_s(), etc.
8. Added more floating-point processing macros.
9. Anonymous struct/union support, which has long existed in gcc, and C11 introduces it into the standard.
10. Static assertions (Static assertions), _Static_assert(), which are processed after interpreting #if and #error.
11. New fopen() mode, ("…x"), similar to O_CREAT|O_EXCL in POSIX, which is commonly used in file locks.
12. Added quick_exit() function as a third way to terminate the program. When exit() fails, the least cleaning work can be done.
13. _Atomic type modifier and <stdatomic.h> header file.

Language Components
Basic Composition

Data Types
The data types of C include: integer type, character type, real type or floating type (single-precision and double-precision), enumeration type, array type, structure type, union type, pointer type, and void type.
Constants and Variables
The value of a constant cannot be changed, and the symbolic constant name is usually in uppercase.
A variable is a quantity whose name is an identifier and whose value can be changed. The identifier is a sequence composed of letters or underscores followed by a string of letters, numbers, or underscores. Please note that the first character must be a letter or underscore, otherwise it is an illegal variable name. Variables are allocated corresponding storage units at compile time.
Array
If a variable name is followed by a bracket with a number, this declaration is an array declaration. A string is also an array. They end with the ASCII NULL. It should be particularly noted that the index value in the square brackets starts from 0.
Pointer
If a * is used in front of a variable declaration, it indicates that this is a pointer variable. In other words, the variable stores an address, and * (specifically referring to the unary operator * here, the same below. There is also a binary operator * in the C language) is the content fetch operator, which means fetching the content stored in this memory address. Pointers are one of the main features of the C language that distinguish it from other contemporary high-level languages.
Pointers can not only be the address of a variable, but also the address of an array, array elements, and functions. Through pointers as formal parameters, more than one return value can be obtained during the function call process, which is different from return (z) which can only get one return value.
Pointers are a double-edged sword. Many operations can be naturally expressed through pointers, but incorrect or excessive use of pointers will bring a large number of potential errors to the program.
String
The string of the C language is actually a char array ending with the '\0' character. Using a character type does not require referencing a library, but using a string requires some functions in the C standard library to operate on the string. They are different from character arrays. Using these functions requires referencing the header file <string.h>.
File Input/Output
In the C language, input and output are implemented through a set of functions in the standard library. In ANSI C, these functions are defined in the header file <stdio.h>;
Standard Input/Output
There are three standard input/outputs that are pre-defined by the standard I/O library:
stdin standard input
stdout standard output
stderr input and output error
Operation
The operation of the C language is very flexible and has very rich functions. The number of operation types is far more than that of other programming languages. In terms of expressions, it is more concise than other programming languages. For example, self-increment, self-decrement, comma operation, and ternary operation make the expression simpler, but beginners often find this expression difficult to read. The key reason is that they do not fully understand the operator and the operation order. When a variety of different operations form an operation expression, that is, when multiple operators appear in an operation expression, the priority order and associative rules of the operations are very important. In learning, it is reasonable to classify them, find the differences from the operations learned in mathematics, and then it is not difficult to remember these operations. Some operators will be firmly remembered after understanding, and will be handy in the future, while some can be temporarily forgotten and remembered when used.
First, it is necessary to clarify that the operators are classified according to different priorities. The operators in "C Programming" can be divided into 15 levels of priorities, from high to low, with priorities 1 ~ 15. Except for levels 2.13 and 14, which are combined from right to left, the others are combined from left to right, which determines the operation order of operators at the same level.

Keywords

Keywords are also called reserved words, that is, words that have been used by the C language itself and cannot be used for other purposes. For example, keywords cannot be used as identifiers such as variable names and function names
There are a total of 32 keywords defined by the ISO standard for the C language:
auto double int struct break else long switch
case enum register typedef char extern return union
const float short unsigned continue for signed void
default goto sizeof volatile do if while static inline
restrict _Bool _Complex _Imaginary _Generic

Basic Data Types
void: Declare that the function has no return value or no parameters, declare a pointer of no type, and explicitly discard the operation result. (Added in C89 standard)
char: Character type data, which belongs to a kind of integer data. (Introduced during K&R period)
int: Integer data, indicating the range usually specified by the compiler's memory bytes. (Introduced during K&R period)
float: Single-precision floating-point data, which belongs to a kind of floating-point data. (Introduced during K&R period)
double: Double-precision floating-point data, which belongs to a kind of floating-point data. (Introduced during K&R period)
_Bool: Boolean type (added in C99 standard)
_Complex: Basic type of complex number (added in C99 standard)
_Imaginary: Imaginary number, similar to the basic type of complex number, a pure imaginary number without a real part (added in C99 standard)
_Generic: Provide an interface entry for overloading (added in C11 standard)
Type Modifier Keywords
short: Modify int, short integer data, and the modified int can be omitted. (Introduced during K&R period)
long: Modify int, long integer data, and the modified int can be omitted. (Introduced during K&R period)
long long: Modify int, super long integer data, and the modified int can be omitted. (Added in C99 standard)
signed: Modify integer data, signed data type. (Added in C89 standard)
unsigned: Modify integer data, unsigned data type. (Introduced during K&R period)
restrict: Used to limit and restrict pointers, and indicate that the pointer is the only and initial way to access a data object. (Added in C99 standard)
Complex Type Keywords
struct: Structure declaration. (Introduced during K&R period)
union: Union declaration. (Introduced during K&R period)
enum: Enumeration declaration. (Added in C89 standard)
typedef: Declare type alias. (Introduced during K&R period)
sizeof: Get the size of a specific type or specific type variable. (Introduced during K&R period)
inline: Inline function is used to replace macro definition and will be expanded in any place where it is called. (Added in C99 standard)
Storage Level Keywords
auto: Specify as an automatic variable, which is automatically allocated and released by the compiler. Usually allocated on the stack. Opposite to static. When the variable is not specified, it is automatically auto by default. (Introduced during K&R period)
static: Specify as a static variable, allocated in the static variable area. When modifying a function, specify that the function scope is internal to the file. (Introduced during K&R period)
register: Specify as a register variable, and suggest that the compiler store the variable in the register for use. It can also modify function parameters and suggest that the compiler pass parameters through the register instead of the stack. (Introduced during K&R period)
extern: Specify the corresponding variable as an external variable, that is, indicate that the definition of the variable or function is in another file, and prompt the compiler to find its definition in other modules when encountering this variable and function. (Introduced during K&R period)
const: Specify that the variable cannot be changed by the current thread (but may be changed by the system or other threads). (Added in C89 standard)
volatile: Specify that the value of the variable may be changed by the system or other threads, and force the compiler to always obtain the value of the variable from the memory, preventing the compiler from optimizing the variable into a register variable. (Added in C89 standard)

Flow Control Keywords

Jump Structure
return: Used in the function body to return a specific value (if it is of void type, it does not return a function value). (Introduced during K&R period)
continue: End the current loop and start the next loop. (Introduced during K&R period)
break: Jump out of the current loop or switch structure. (Introduced during K&R period)
goto: Unconditional jump statement. (Introduced during K&R period)
Branch Structure
if: Conditional statement, no semicolon needs to be placed later. (Introduced during K&R period)
else: Conditional statement negative branch (used with if). (Introduced during K&R period)
switch: Switch statement (multiple branch statement). (Introduced during K&R period)
case: Branch mark in the switch statement, used with switch. (Introduced during K&R period)
default: "Other" branch in the switch statement, optional. (Introduced during K&R period)

Compilation

#define precompilation macro
#if expression #else if expression #else #endif conditional compilation
#ifdef macro #else #endif conditional compilation
#ifndef macro #else #endif conditional compilation and conditional compilation

Syntax Structure

Sequential Structure

The sequential structure program design is the simplest. As long as the corresponding statements are written in the order of solving the problem, its execution order is from top to bottom, and it is executed in sequence.
For example: a = 3, b = 5, now exchange the values of a and b. This problem is like exchanging water in two cups. Of course, a third cup is needed. Suppose the third cup is c, then the correct program is: c = a; a = b; b = c; the execution result is a = 5, b = c = 3. If the order is changed, written as: a = b; c = a; b = c; then the execution result becomes a = b = c = 5, which cannot achieve the expected purpose. Beginners are most likely to make this kind of mistake. The sequential structure can be used independently to form a simple complete program. The common three-step program of input, calculation, and output is a sequential structure. For example, calculate the area of a circle. The statement order of its program is to input the radius r of the circle, calculate s = 3.14159*r*r, and output the area s of the circle. However, in most cases, the sequential structure is part of the program, and forms a complex program with other structures. For example, the compound statement in the branch structure, the loop body in the loop structure, etc.

Selection Structure

The sequential structure program can solve problems such as calculation and output, but cannot make judgments and selections. For problems that need to make judgments and selections first, the selection structure should be used. The execution of the selection structure is based on certain conditions to select the execution path, rather than strictly following the physical order of the statements. The program design method of the selection structure is to construct a suitable branch condition and analyze the program flow. Select the appropriate selection statement according to different program flows. The selection structure is suitable for calculations with logical or relational comparison and other condition judgments. When designing such a program, it is often necessary to draw its program flow chart first, and then write the source program according to the program flow, which separates the program design analysis from the language, making the problem simple and easy to understand. The program flow chart is the program execution flow chart drawn according to the problem analysis.

Loop Structure

The loop structure can reduce the workload of repeatedly writing source programs, and is used to describe the problem of repeatedly executing a certain algorithm. This is the program structure that can best exert the characteristics of the computer. The C language provides four loops, namely goto loop, while loop, do while loop, and for loop. The four loops can be used to handle the same problem. Generally, they can be replaced with each other, but generally, the goto loop is not advocated, because forcibly changing the order of the program often brings unpredictable errors to the operation of the program.
Special attention should be paid to including statements that tend to end in the loop body (that is, the change of the loop variable value), otherwise it may become an infinite loop, which is a common mistake of beginners.
The similarities and differences of the three loops: When using the while and do...while loops, the initialization operation of the loop variable should be before the loop body, while the for loop is generally carried out in statement 1; the while loop and the for loop both judge the expression first, and then execute the loop body, while the do...while loop executes the loop body first and then judges the expression, that is to say, the loop body of do...while is executed at least once, while the while loop and for may not be executed even once. In addition, it should also be noted that these three loops can all use the break statement to jump out of the loop, and use the continue statement to end this loop, while the loop composed of the goto statement and if cannot be controlled by the break and continue statements.
The sequential structure, branch structure, and loop structure are not isolated from each other. There can be branches and sequential structures in the loop, and there can be loops and sequential structures in the branch. In fact, no matter which structure, they can be generally regarded as a statement. In the actual programming process, these three structures are often combined with each other to implement various algorithms and design corresponding programs. However, if the problem to be programmed is large, the written program is often very long and has repeated structures, resulting in poor readability and difficult understanding. The method to solve this problem is to design the C program into a modular structure.
Specific content:
for loop
The for loop structure is the most characteristic loop statement in the C language, and it is the most flexible and convenient to use. Its general form is:
for (expression 1; expression 2; expression 3) loop body statement. (Where; cannot be omitted)
Expression
Expression 1 is the initial value expression, used to assign an initial value to the loop variable before the loop starts.
Expression 2 is the loop control logic expression, which controls the condition for loop execution and determines the number of loops.
Expression 3 is the loop control variable modification expression, which makes the for loop tend to end.
The loop body statement is the statement that is repeatedly executed when the loop control condition is established.
However, in the entire for loop process, expression 1 is calculated only once, and expressions 2 and 3 may be calculated multiple times or not at all. The loop body may be executed multiple times or not at all.
First execute expression 2, then execute the loop structure, and finally expression 3, and this cycle continues.
The for loop statement is the most powerful statement in the C language, and can even replace other loop statements to a certain extent.
do
do loop structure, the execution order of do 1 while⑵; is 1->2->1... loop, and 2 is the loop condition.
while
while loop structure, the execution order of while(1) 2; is 1->2->1... loop, and 1 is the loop condition
The above loop statements continue the loop when the loop condition expression is true, and jump out of the loop when it is false.

Program Structure

The modular program structure of the C language is implemented by functions, that is, divide a large problem into several modules, each module is written as a C function, and then the main function calls the function and the function calls the function to implement the C program writing of a large problem. Therefore, it is often said: C program = main function + sub-function. Therefore, special attention should be paid to understanding and application of the definition, call, and value return of functions, and consolidated through debugging on the computer.

Judgment Statement (Selection Structure):

if statement: "If" statement; if-else statement: "If... (then)... else..." statement; switch statement: "Switch" statement; switch-case: "Switch-case" statement.

Loop Statement (Loop Structure):

while statement: "When..." statement; do-while statement: "Do... when... (time)" statement; for statement: conditional statement (that is, "(do)... for... " statement).

Jump Statement (Loop Structure: Whether to Loop):

goto statement: "Steering" statement, also called "jump" statement; break statement: "Interrupt" (loop) statement, that is, end the entire loop; continue statement: "Continue" statement (end this loop, continue the next loop); return statement: "Return" statement.
It needs to be explained that:
1. A C language source program can be composed of one or more source files.
2. Each source file can be composed of one or more functions.
3. A source program, no matter how many files it is composed of, has one and only one main function, that is, the main function. It is the entry of the entire program.
4. There can be preprocessing commands (including include commands, ifdef, ifndef commands, define commands) in the source program, and the preprocessing commands should usually be placed at the front of the source file or source program.
5. Each statement and each statement must end with a semicolon. But preprocessing commands, function headers, and curly braces "}" should not be followed by semicolons. (The "}" after the declaration of struct, union, and enumeration type should be followed by ";".)
6. There must be at least one space between identifiers and keywords to show the interval. If there are obvious interval symbols, no more spaces need to be added to separate.
Writing Rules
1. One statement or one statement occupies one line.
2. The part enclosed in {} usually represents a certain level of structure of the program. {} is generally aligned with the first letter of this structure statement and occupies a line alone.
3. The statements or instructions of the lower level can be written with several more spaces than the statements or instructions of the higher level. In order to look more clear and increase the readability of the program. When programming, you should try to follow these rules to develop a good programming style.

Function

A C program is composed of a set of external objects of variables or functions. A function is a self-contained execution code segment that completes certain related functions. We can regard a function as a "black box". As long as you send data in, you can get the result, and the external program does not know how the function works internally. All the external program knows is what is input to the function and what is output by the function. Functions provide a means of programming, making it easy to read, write, understand, debug, modify, and maintain.
The number of functions in a C program is actually unlimited. If there is any restriction, it is that there must be at least one function in a C program, and there must be one and only one function named main, which is called the main function, and the entire program starts from this main function.
The C language encourages and advocates that people divide a big problem into sub-problems, and compile a function for each sub-problem. Therefore, a C language program is generally composed of a large number of small functions rather than a small number of large functions, that is, "small functions constitute a large program". The advantage of this is that each part is fully independent and has a single task. Therefore, these fully independent small modules can also be used as a fixed specification of small "components" to form a new large program.
Over the years of development of the C language, a huge number of systems and programs developed with the C language have been accumulated. At the same time, a lot of directly usable library functions have also been accumulated.
ANSI C provides standard C language library functions.
Beginners of the C language prefer Turbo C 2.0, which provides more than 400 runtime functions, each of which completes a specific function, and users can call them freely. These functions are generally divided into input and output functions, mathematical functions, string and memory functions, functions related to BIOS and DOS, character screen and graphics functions, process control functions, directory functions, etc.
The Windows SDK provided by the Windows system contains thousands of functions related to Windows application development.
Other operating systems, such as Linux, also provide a large number of functions for application program developers to call.
As a programmer, you should try to be familiar with the functions of the target platform library. In this way, you can develop application programs for a specific platform with ease. For example, as a developer of Windows applications, you should try to be familiar with the Windows SDK; as a developer of Linux applications, you should try to be familiar with the Linux system calls and POSIX function specifications.

Operators

It is particularly special that the bit right shift (>>) operator can be arithmetic (the highest significant bit is filled on the left end) or logical (0 is filled on the left end) shift. For example, shifting 11100011 right by 3 bits, the arithmetic right shift becomes 11111100, and the logical right shift becomes 00011100. Because arithmetic bit right shift is more suitable for handling negative integers, almost all compilers are arithmetic bit right shift.
The priority of operators is roughly from high to low: unary operators, arithmetic operators, relational operators, logical operators, conditional operators, assignment operators (=), and comma operators.

()、 、 -> 、 .、!、 ++、 -- Parentheses, square brackets, pointer, member, logical not, self-increment, self-decrement
++ 、 -- 、 * 、 & 、 ~ 、! Unary operators
+、 - 、 sizeof、(cast)  
* 、 / 、% Arithmetic operators
+ 、 - Arithmetic operators
<< 、 >> Bit operators
< 、 <= 、 > 、 >= Relational operators
== 、!= Relational operators
& Bitwise AND
^ Bitwise XOR
| Bitwise OR
&& Logical AND
|| Logical OR
? 、: Conditional operator
/= 、%= 、 &= 、 |= 、 ^= Assignment operator
= 、 += 、 -= 、 *= 、  
, Sequence operator

Classic Errors
The usage of void main() is not formulated by any standard. The C language standard syntax is int main. Any implementation must support int main(void) { /* ... */ } and int main(int argc, char* argv) { /* ... */ }.
Operations like a+=a++ or (i++)+(i++)+(i++) belong to undefined behavior. It is not that this behavior has not been defined in the C language, it has long been concluded. Its result depends on the compiler implementation. Do not write such code!

References

1. Stephen Prata.C Primer Plus.United States: People's Post and Telecommunications Press, 2005: 1-3
2. Su Xiaohong, Sun Zhigang, Chen Huipeng.Practical C Language Tutorial.Beijing: Electronic Industry Press, 2013: 8-8
3. Development Process of C Language .C Language Chinese Network.2012-04-28
4. American National Standards Institute (ANSI - American National Standards Institute) .Standard Information Network
5. ISO/IEC 9899:1990 - Programming languages -- C .International Organization for Standardization (ISO - International Organization for Standardization)
6. ISO/IEC 9899:1990/Cor 1:1994 .International Organization for Standardization (ISO - International Organization for Standardization)
7. ISO/IEC 9899:1990/Amd 1:1995 - C Integrity .International Organization for Standardization (ISO - International Organization for Standardization)
8. ISO/IEC 9899:1999 - Programming languages -- C .International Organization for Standardization (ISO - International Organization for Standardization)
9. ISO/IEC 9899:2011 - Information technology -- Programming languages -- C .International Organization for Standardization (ISO - International Organization for Standardization)
10. Related Introduction to C Language Programming Tutorial .Spark Tutorial Network.2012-03-22

[ Last edited by zzz19760225 on 2018-7-31 at 21:29 ]
1<词>,2,3/段\,4{节},5(章)。
Floor 2 Posted 2016-06-26 18:29 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
1 Display help text, txt, chm,
main()
{
paintf("What do you need now?/n")
paintf("Need a C language help manual./n")
paintf("The content of this book is about the overall comprehensive part and the divided part of C language. The comprehensive part includes hardware and C language as well as C language editor content. The divided part includes command text, command grammar, simple Q&A - type algorithms, general algorithms often needed for completing homework, a content year list of comprehensive algorithms that can be known, and this year is not included./n")
paintf("Now start reading this book, and the specific content is as follows: ....../n")
}

Can C language and grub be similar, directly operating help files on your own computer, concentrating on several common, important, convenient, and short - word - count commands.

How to store these help book information in the computer and display these contents in all command lines and character modes?

1 How to display in the command line, especially grub, as well as editing programs.
2 The efficient methods, commands, or software, or editors for converting the content of a book or an article into C language information bodies.
3 Appropriate amount of information and requirements, respectively for beginners, intermediate - level users, and veterans (the veteran part is for some adapted reading help, finding some classic comprehensive system book and article groups with new wine in old bottles).

[ Last edited by zzz19760225 on 2016 - 8 - 6 at 17:16 ]
1<词>,2,3/段\,4{节},5(章)。
Floor 3 Posted 2016-06-26 18:30 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
Help and Q&A section

For the search Q&A of help information.

It belongs to the calculation of one plus one equals two.

Question + question = answer.

Concentration of primary books, concentration of intermediate books, concentration of advanced books.

Cases for novices and beginners to learn. Instead of using Hello Word, you can use the simple mode of tank battles, representing the points or circles of your own tank, eight-direction movement and step speed, fired bullets or shells, boundaries, and combat parts. Secondly, the part of commanding the battle, copying your own content and then adding random movement.

It is also good to use the fighting mode of stick figures.

Primary books should add the function part, and add the corresponding part of high school mathematics functions in it.

[ Last edited by zzz19760225 on 2016-9-29 at 21:55 ]
1<词>,2,3/段\,4{节},5(章)。
Floor 4 Posted 2016-06-26 18:30 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
Hardware and C editor connection. Different hardware is like a wine bottle, holding the wine of the C language. The retrieval of hardware should be incorporated into the editor's functions, and the loading of hardware information as a basis. If you are familiar with it, you can pour the wine in. Assume that the language mode is tested and verified.

[ Last edited by zzz19760225 on 2016-7-6 at 03:52 ]
1<词>,2,3/段\,4{节},5(章)。
Floor 5 Posted 2016-06-26 18:31 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
Suppose there is an industry information concentration association for the C language, the free mode of Chinese people, which is also for the middle-level software and hardware reliable language that handles Chinese character digital information.

Chinese character - type assembly,

the grammar and ownership language of the fully free - structure of Chinese characters.

In a specific concept range, for the free range of possibility, the relatively appropriate restrictive language generated by practice is selected as the popularized content, and this popularized content is the standard.

In the mutual conversion between one purpose and behavior path, it is easy to lose the direction originally aimed at.

Tao, change, possibility, uncertainty, feasibility. Freedom.

The abstract concept of technical freedom has different range concept circle sets on different things, mainly divided into directions by known and unknown knowable.

The range of existing hardware, the available range of existing hardware, the use content in the available range of existing hardware and the standardized stable range of use.

Completely using manual work is just like the quality comparison between agricultural groups and industrial - agricultural groups. The role of robots is efficiency, not replacement, and they are used as a tool, not as a representative of human emotions to replace human beings themselves, just like the relationship between pets and people (a person with an extreme preference for his own pet may ignore the concept of the same person between others and himself when comparing his pet with others, but when there is a life - death choice between himself and the pet, he will generally choose to give up the pet, which is an external thing).

The relationship between programming languages and the available range of hardware, as well as the relationship with existing programming language standards, this needs to be very familiar with existing content, just like learning to drill out the concept group of knowledge.

Knowledge inertia, layman interaction, service requirements, extreme gradual change, seeking renewal.

[ Last edited by zzz19760225 on 2016-9-29 at 17:54 ]
1<词>,2,3/段\,4{节},5(章)。
Floor 6 Posted 2016-06-26 18:32 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
Basic character information of Chinese DOS,
Language editor tools, basic environment for boot systems or existing Linux Veket, FREEDOS, Windows cmd,
Structure, permissions, scope, content, fairness
Algorithm, efficiency,
Interface, function, overall comprehensive use of function application acquisition,
Optimized automatic and manual, stand-alone, single-user, machine-wide security and information security issues, security issues of machine user information in the network,
Update, feedback, network help, network community, individual network communication gateway servers,
Life editing software,
Work editing software,
Study editing software.
Life first, corresponding to the word usage needs of life application, from ignorance to knowledge in family education, and the insufficient parts of food, clothing, housing, transportation and entertainment needs.
Study second, corresponding to the growth middle school era and self-study structure, the spirit of lifelong learning, and striving for better to produce better.
Work finally, entering society to take the basic work with self-survival, life and study comprehensive content as the object, and the work life that integrates other contents as the profession, including the lifelong professional work and interest work that transforms from working for others to self-employment.

The parts of coding ignorance, knowledge, knowable, unknown, and unknowable, concentrated in the stable, reliable, free, and efficient content at the long-term and ten-year era levels of knowledge, stable and willing to accept, reliable and able to entrust things, free and able to adapt to the changes of the times, and efficient to realize more time for life, study, and work. Coding square?

[ Last edited by zzz19760225 on 2016-7-6 at 20:40 ]
1<词>,2,3/段\,4{节},5(章)。
Floor 7 Posted 2016-06-26 18:33 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
GCC, Emacs, Vim under 1veket (this needs to be tried to implement),
FreeDOS, MS-DOS, TC editor under virtual machine or physical machine,
Hardware and partition table, BIOS of physical machine, exploration of construction in three changing environments, changing hardware and environment, and relatively unchanged information knowledge and technical structure.

[ Last edited by zzz19760225 on 2016-7-7 at 04:16 ]
1<词>,2,3/段\,4{节},5(章)。
Floor 8 Posted 2016-06-26 18:34 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
1

Developing shells and sell programming
Creating tools and resource materials, exploring unknown areas, and using tools to produce products and serve users.

Using programming languages to draw the desired content, each stroke is an instruction, resulting in a content that is added to the receiver to form the painting process of pursuing personal needs.

The current programming languages cannot run directly. The desired use effect is to reach the operating system, software, and hardware interface, like an intermediate microphone. The content input by the user needs to be synchronized or nearly synchronized to the instruction object and form an overall state reduced graph or map. Multiple layers of information statistics form different information maps, and relative modifications and viewing of differences are carried out through the maps to explore possible limits.

In Linux, Vim is preferred, which is relatively convenient and can be used without any adjustments.

Computer motherboard hardware information addresses (pointers?), calculation addresses, memory addresses, hard disk addresses, USB flash drive addresses, user interface hardware addresses (displays, graphics cards, sound cards, speakers, network cards, routers).

The state of the operating system, static and dynamic. Abacus-style operating system, still water-style operating system, flowing water-style operating system, stone-style operating system, animal-style operating system. Mechanical electrical computers, input calculation computers, active human-like computers.

Interrupt the information transportation route at any time, return to the starting point at any time, stop the ongoing transportation route and transfer to the designated starting point, temporarily stop and then continue, and end all routes.

Programming language table, overlapping layers of grid tables, data information grid steering jumper instructions (running from one grid to a grid on another table).

Similar to sed, ex, and vi single-sentence input. This input is relatively a whole, which can be in a dynamic loop state similar to debugging or a static grid filling behavior similar to grid tables.

Layer restrictions and non-restricted layer free grid relationships of grid tables.
Based on free information, move towards feasible, usable, and reliable.

Build grid tables with 3D software, and place conceptual circles and origin information in the grid tables.

The dynamic and static exchange for novice learners. First, it is a programming game that can change through visible part number modification. Second, open existing 3D grid table information knowledge technology help books for learning. When tired, go to modify that dynamic loop programming game. The common basis of the two is within the same programming language range, and the long-term hardware interface, application software, and operating system all follow this path. The content with potentially infinite freedom makes this path only a direction that can be determined, and the rest cannot be predicted, only the present made and the past summarized. Beyond the extended surplus of being familiar with and able to use Loongson, get familiar with other computers from the same instruction set.

A block diagram composed of grid circles storing graphics blocks, somewhat similar to a hard disk. The block group diagram is for the layer-by-layer extension needs of information layers. A name needs to be stored, for example, the two Chinese characters "file". Convert it to binary through 18030 and hexadecimal numbers. These binary numbers form a number group, and these number groups are projected onto the circuit storage of the hard disk in the mode of their own shadow projection. At this time, there is the name "file" displayed on the screen, and there is also the binary shadow of "file" in the hard disk, as well as the process information path or information flow around this name and shadow. The external hardware comes with its own driver and the three-body operating system's own hardware driver play their roles respectively, and there is no need to find and install hardware drivers separately (driver updates can idle the hardware's own attached driver). The middle group range of one-fifth of precaution and one-fifth of trust, thus dividing into three states between the two ends of trust and suspicion between people: extreme trust, extreme suspicion, and the approximate intermediate change range between the main and secondary.

The free state of material state, the intermediate normal free state, and the free state of human needs. The concept of possible freedom and the concept of choice behavior, the concept of having power, consciousness being and being aware. The reverse negative freedom concept of freedom and the anti-free concept directly extending to the extreme. The reasonable state of freedom is freedom. Define another freedom of freedom and relative definition before freedom as no freedom. The non-freedom caused by text definition comparison, and the usable nature of non-freedom. Behavioral freedom and non-freedom.

The free limit of the three-layer concept, common roads, and human needs bottom line. The programming needs limit is something that humans cannot see or understand completely, but this uncertain infinite concept space of limit can exist, which can be considered as an assumption, and it is best if it can be used. In the existing content, there is always a relatively good time, era, and past content (a state that can play efficiency relatively). When encountering disasters and thinking about the limit, there will be the comprehensive content of the survival of life in this world at the line of death, without air, without water, without food, without internal organ functions, etc., the bottom line of human survival. The survival, common use, and limit of programming languages.

Adding, subtracting, and extending pipe symbols, and the variation of the equal sign. Equal sign, not equal sign, approximately equal sign, plus-minus sign,

~Using the approximately equal sign will conflict with the concept of the approximately equal sign. Add a plus and minus sign above and below the approximately equal sign. The definition error summary of the approximately equal sign, and the addition and subtraction of the plus-minus sign follow the content to be added as needed. The content between one plus-minus sign and another plus-minus sign is a round, and the sum of the comprehensive content of the first content after each plus-minus sign and the preceding content. The continuous updating process of certain and uncertain random content.

Using ex mode, half-side operation of grid tables, input grid name, input needed content, set content on the road, similar to plus-minus sign calculation.
The other half is the intuitiveness of 3D graphics, and this intuitive process can establish a tree structure branch, parallel running part, and modification part through the ex-like operation mode of the other half. This 3D grid table function is integrated in the operating system or functional software, hardware interface, and needs to simplify the running content and volume size.

Distinguish the expression of binary from decimal and other number systems. None, nothing is zero, something is one, nothing and nothing is something, nothing and something is something, something and something is nothing. How to make the content of different number system calculations, numbers and characters distinction travel well in natural language communication dominated by characters? The great way is chaotic and tends to branch, with the upper and lower layers of the limit on the road similar to batch processing, special and individual spaces and transformations.



Number form, function set, points, line segments, rays, straight lines, squares, circular lines, regular curves, irregular curves of digital concepts. Regular solids, irregular solids. Regular multi-dimensional bodies, irregular multi-dimensional bodies.
Classification of regular layers within number forms, classification of irregular layers within number forms.
Regular numbers, irregular numbers.
Accurate calculation and inaccurate calculation between regular numbers and irregular numbers, obtainable results and non-obtainable results, definition of numbers and results, approximately equal results.
||||||
---------------------------------------------------
| | | | | | | | | |
---------------------------------------------------
|( )| ( )|()| ()| ()|()|()|()|( )|
---------------------------------------------------
| / | / | / | / | / | \ | \ | \ | \ |
+----+-----+-----+----+----+----+---+----+-----+
| > | > | < | < | > | > | > | > | < |
---------------------------------------------------
Some content is obviously walked by someone, and it can be used directly, but it is necessary to find the needed content at the appropriate time, and a part of sharing, standard name, and search is needed.

Name, address, name creation time, information size, statistics standard,
Modification time 1, result, address path, start, remarks;
Modification time 2, , , , ;
Modification information is used for data recovery.

Name, starting warehouse, transport vehicle, transport path, ending warehouse.
The name includes all information,

Command name / command content (name, starting warehouse, transport vehicle, transport path, ending warehouse) / time /

Time, past time, present time, future time,
Past record modification recovery time, present use time, calibration time, error time, future budget plan class need use time.
Extract lines for comparison by light sensing angle, count approximate time values based on days for time missing. Quartz clock time, radio wave time, network China time, network foreign time.

Do not define the space size, minimum ten times, hundred times, thousand times, ten thousand times space, minimum one to five times space.
Sequential storage saves space, increases memory and hard disk space, compressed storage space.
These contents should be in the forum.

[ Last edited by zzz19760225 on 2016-9-30 at 02:16 ]
1<词>,2,3/段\,4{节},5(章)。
Floor 9 Posted 2016-06-26 18:36 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
1C -> C++ -> go -> vala->gtk..................qml qt..........

[ Last edited by zzz19760225 on 2016-7-28 at 15:18 ]
1<词>,2,3/段\,4{节},5(章)。
Floor 10 Posted 2016-06-26 18:37 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
4 Functions Implementing a C Compiler: C4
C4 2014-11-13 12:57:30 Published
Your rating:

0.0
Collect 0 Collections
A C compiler implemented with 4 functions, approximately 500 lines. Basically quite complete and can compile itself.

Usage method:

gcc -o c4 c4.c (you may need the -m32 option on 64-bit machines)
./c4 hello.c
./c4 -s hello.c

./c4 c4.c hello.c
./c4 c4.c c4.c hello.c
Project homepage: http://www.open-open.com/lib/view/home/1415851490758


// c4.c - C in four functions

// char, int, and pointer types
// if, while, return, and expression statements
// just enough features to allow self-compilation and a bit more

// Written by Robert Swierczek

#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <unistd.h>
#include <fcntl.h>

char *p, *lp, // Current position in the source code
*data; // Data/bss pointer

int *e, *le, // Current position in the emitted code
*id, // Currently parsed identifier
*sym, // Symbol table (simple list of identifiers)
tk, // Current token
ival, // Current token value
ty, // Current expression type
loc, // Local variable offset
line, // Current line number
src, // Print source and assembly flag
debug; // Print executed instructions

// Tokens and classes (operators last and in precedence order)
enum {
Num = 128, Fun, Sys, Glo, Loc, Id,
Char, Else, Enum, If, Int, Return, Sizeof, While,
Assign, Cond, Lor, Lan, Or, Xor, And, Eq, Ne, Lt, Gt, Le, Ge, Shl, Shr, Add, Sub, Mul, Div, Mod, Inc, Dec, Brak
};

// Opcodes
enum { LEA ,IMM ,JMP ,JSR ,BZ ,BNZ ,ENT ,ADJ ,LEV ,LI ,LC ,SI ,SC ,PSH ,
OR ,XOR ,AND ,EQ ,NE ,LT ,GT ,LE ,GE ,SHL ,SHR ,ADD ,SUB ,MUL ,DIV ,MOD ,
OPEN,READ,CLOS,PRTF,MALC,MSET,MCMP,EXIT };

// Types
enum { CHAR, INT, PTR };

// Identifier offsets (since we can't create an ident struct)
enum { Tk, Hash, Name, Class, Type, Val, HClass, HType, HVal, Idsz };

void next()
{
char *pp;

while (tk = *p) {
++p;
if (tk == '\n') {
if (src) {
printf("%d: %.*s", line, p - lp, lp);
lp = p;
while (le < e) {
printf("%8.4s", &"LEA ,IMM ,JMP ,JSR ,BZ ,BNZ ,ENT ,ADJ ,LEV ,LI ,LC ,SI ,SC ,PSH ,"
"OR ,XOR ,AND ,EQ ,NE ,LT ,GT ,LE ,GE ,SHL ,SHR ,ADD ,SUB ,MUL ,DIV ,MOD ,"
"OPEN,READ,CLOS,PRTF,MALC,MSET,MCMP,EXIT,");
if (*le <= ADJ) printf(" %d\n", *++le); else printf("\n");
}
}
++line;
}
else if (tk == '#') {
while (*p != 0 && *p != '\n') ++p;
}
else if ((tk >= 'a' && tk <= 'z') || (tk >= 'A' && tk <= 'Z') || tk == '_') {
pp = p - 1;
while ((*p >= 'a' && *p <= 'z') || (*p >= 'A' && *p <= 'Z') || (*p >= '0' && *p <= '9') || *p == '_')
tk = tk * 147 + *p++;
tk = (tk << 6) + (p - pp);
id = sym;
while (id) {
if (tk == id && !memcmp((char *)id, pp, p - pp)) { tk = id; return; }
id = id + Idsz;
}
id = (int)pp;
id = tk;
tk = id = Id;
return;
}
else if (tk >= '0' && tk <= '9') {
if (ival = tk - '0') { while (*p >= '0' && *p <= '9') ival = ival * 10 + *p++ - '0'; }
else if (*p == 'x' || *p == 'X') {
while ((tk = *++p) && ((tk >= '0' && tk <= '9') || (tk >= 'a' && tk <= 'f') || (tk >= 'A' && tk <= 'F')))
ival = ival * 16 + (tk & 15) + (tk >= 'A' ? 9 : 0);
}
else { while (*p >= '0' && *p <= '7') ival = ival * 8 + *p++ - '0'; }
tk = Num;
return;
}
else if (tk == '/') {
if (*p == '//') {
++p;
while (*p != 0 && *p != '\n') ++p;
}
else {
tk = Div;
return;
}
}
else if (tk == '\'' || tk == '"') {
pp = data;
while (*p != 0 && *p != tk) {
if ((ival = *p++) == '\\') {
if ((ival = *p++) == 'n') ival = '\n';
}
if (tk == '"') *data++ = ival;
}
++p;
if (tk == '"') ival = (int)pp; else tk = Num;
return;
}
else if (tk == '=') { if (*p == '=') { ++p; tk = Eq; } else tk = Assign; return; }
else if (tk == '+') { if (*p == '+') { ++p; tk = Inc; } else tk = Add; return; }
else if (tk == '-') { if (*p == '-') { ++p; tk = Dec; } else tk = Sub; return; }
else if (tk == '!') { if (*p == '=') { ++p; tk = Ne; } return; }
else if (tk == '<') { if (*p == '=') { ++p; tk = Le; } else if (*p == '<') { ++p; tk = Shl; } else tk = Lt; return; }
else if (tk == '>') { if (*p == '=') { ++p; tk = Ge; } else if (*p == '>') { ++p; tk = Shr; } else tk = Gt; return; }
else if (tk == '|') { if (*p == '|') { ++p; tk = Lor; } else tk = Or; return; }
else if (tk == '&') { if (*p == '&') { ++p; tk = Lan; } else tk = And; return; }
else if (tk == '^') { tk = Xor; return; }
else if (tk == '%') { tk = Mod; return; }
else if (tk == '*') { tk = Mul; return; }
else if (tk == '

' || tk == ',' || tk == ':') return;
}
}

void expr(int lev)
{
int t, *d;

if (!tk) { printf("%d: unexpected eof in expression\n", line); exit(-1); }
else if (tk == Num) { *++e = IMM; *++e = ival; next(); ty = INT; }
else if (tk == '"') {
*++e = IMM; *++e = ival; next();
while (tk == '"') next();
data = (char *)((int)data + sizeof(int) & -sizeof(int)); ty = PTR;
}
else if (tk == Sizeof) {
next(); if (tk == '(') next(); else { printf("%d: open paren expected in sizeof\n", line); exit(-1); }
ty = INT; if (tk == Int) next(); else if (tk == Char) { next(); ty = CHAR; }
while (tk == Mul) { next(); ty = ty + PTR; }
if (tk == ')') next(); else { printf("%d: close paren expected in sizeof\n", line); exit(-1); }
*++e = IMM; *++e = (ty == CHAR) ? sizeof(char) : sizeof(int);
ty = INT;
}
else if (tk == Id) {
d = id; next();
if (tk == '(') {
next();
t = 0;
while (tk != ')') { expr(Assign); *++e = PSH; ++t; if (tk == ',') next(); }
next();
if (d == Sys) *++e = d;
else if (d == Fun) { *++e = JSR; *++e = d; }
else { printf("%d: bad function call\n", line); exit(-1); }
if (t) { *++e = ADJ; *++e = t; }
ty = d;
}
else if (d == Num) { *++e = IMM; *++e = d; ty = INT; }
else {
if (d == Loc) { *++e = LEA; *++e = loc - d; }
else if (d == Glo) { *++e = IMM; *++e = d; }
else { printf("%d: undefined variable\n", line); exit(-1); }
*++e = ((ty = d) == CHAR) ? LC : LI;
}
}
else if (tk == '(') {
next();
if (tk == Int || tk == Char) {
t = (tk == Int) ? INT : CHAR; next();
while (tk == Mul) { next(); t = t + PTR; }
if (tk == ')') next(); else { printf("%d: bad cast\n", line); exit(-1); }
expr(Inc);
ty = t;
}
else {
expr(Assign);
if (tk == ')') next(); else { printf("%d: close paren expected\n", line); exit(-1); }
}
}
else if (tk == Mul) {
next(); expr(Inc);
if (ty > INT) ty = ty - PTR; else { printf("%d: bad dereference\n", line); exit(-1); }
*++e = (ty == CHAR) ? LC : LI;
}
else if (tk == And) {
next(); expr(Inc);
if (*e == LC || *e == LI) --e; else { printf("%d: bad address-of\n", line); exit(-1); }
ty = ty + PTR;
}
else if (tk == '!') { next(); expr(Inc); *++e = PSH; *++e = IMM; *++e = 0; *++e = EQ; ty = INT; }
else if (tk == '~') { next(); expr(Inc); *++e = PSH; *++e = IMM; *++e = -1; *++e = XOR; ty = INT; }
else if (tk == Add) { next(); expr(Inc); ty = INT; }
else if (tk == Sub) {
next(); *++e = IMM;
if (tk == Num) { *++e = -ival; next(); } else { *++e = -1; *++e = PSH; expr(Inc); *++e = MUL; }
ty = INT;
}
else if (tk == Inc || tk == Dec) {
t = tk; next(); expr(Inc);
if (*e == LC) { *e = PSH; *++e = LC; }
else if (*e == LI) { *e = PSH; *++e = LI; }
else { printf("%d: bad lvalue in pre-increment\n", line); exit(-1); }
*++e = PSH;
*++e = IMM; *++e = (ty > PTR) ? sizeof(int) : sizeof(char);
*++e = (t == Inc) ? ADD : SUB;
*++e = (ty == CHAR) ? SC : SI;
}
else { printf("%d: bad expression\n", line); exit(-1); }

while (tk >= lev) { // "precedence climbing" or "Top Down Operator Precedence" method
t = ty;
if (tk == Assign) {
next();
if (*e == LC || *e == LI) *e = PSH; else { printf("%d: bad lvalue in assignment\n", line); exit(-1); }
expr(Assign); *++e = ((ty = t) == CHAR) ? SC : SI;
}
else if (tk == Cond) {
next();
*++e = BZ; d = ++e;
expr(Assign);
if (tk == ':') next(); else { printf("%d: conditional missing colon\n", line); exit(-1); }
*d = (int)(e + 3); *++e = JMP; d = ++e;
expr(Cond);
*d = (int)(e + 1);
}
else if (tk == Lor) { next(); *++e = BNZ; d = ++e; expr(Lan); *d = (int)(e + 1); ty = INT; }
else if (tk == Lan) { next(); *++e = BZ; d = ++e; expr(Or); *d = (int)(e + 1); ty = INT; }
else if (tk == Or) { next(); *++e = PSH; expr(Xor); *++e = OR; ty = INT; }
else if (tk == Xor) { next(); *++e = PSH; expr(And); *++e = XOR; ty = INT; }
else if (tk == And) { next(); *++e = PSH; expr(Eq); *++e = AND; ty = INT; }
else if (tk == Eq) { next(); *++e = PSH; expr(Lt); *++e = EQ; ty = INT; }
else if (tk == Ne) { next(); *++e = PSH; expr(Lt); *++e = NE; ty = INT; }
else if (tk == Lt) { next(); *++e = PSH; expr(Shl); *++e = LT; ty = INT; }
else if (tk == Gt) { next(); *++e = PSH; expr(Shl); *++e = GT; ty = INT; }
else if (tk == Le) { next(); *++e = PSH; expr(Shl); *++e = LE; ty = INT; }
else if (tk == Ge) { next(); *++e = PSH; expr(Shl); *++e = GE; ty = INT; }
else if (tk == Shl) { next(); *++e = PSH; expr(Add); *++e = SHL; ty = INT; }
else if (tk == Shr) { next(); *++e = PSH; expr(Add); *++e = SHR; ty = INT; }
else if (tk == Add) {
next(); *++e = PSH; expr(Mul);
if ((ty = t) > PTR) { *++e = PSH; *++e = IMM; *++e = sizeof(int); *++e = MUL; }
*++e = ADD;
}
else if (tk == Sub) {
next(); *++e = PSH; expr(Mul);
if (t > PTR && t == ty) { *++e = SUB; *++e = PSH; *++e = IMM; *++e = sizeof(int); *++e = DIV; ty = INT; }
else if ((ty = t) > PTR) { *++e = PSH; *++e = IMM; *++e = sizeof(int); *++e = MUL; *++e = SUB; }
else *++e = SUB;
}
else if (tk == Mul) { next(); *++e = PSH; expr(Inc); *++e = MUL; ty = INT; }
else if (tk == Div) { next(); *++e = PSH; expr(Inc); *++e = DIV; ty = INT; }
else if (tk == Mod) { next(); *++e = PSH; expr(Inc); *++e = MOD; ty = INT; }
else if (tk == Inc || tk == Dec) {
if (*e == LC) { *e = PSH; *++e = LC; }
else if (*e == LI) { *e = PSH; *++e = LI; }
else { printf("%d: bad lvalue in post-increment\n", line); exit(-1); }
*++e = PSH; *++e = IMM; *++e = (ty > PTR) ? sizeof(int) : sizeof(char);
*++e = (tk == Inc) ? ADD : SUB;
*++e = (ty == CHAR) ? SC : SI;
*++e = PSH; *++e = IMM; *++e = (ty > PTR) ? sizeof(int) : sizeof(char);
*++e = (tk == Inc) ? SUB : ADD;
next();
}
else if (tk == Brak) {
next(); *++e = PSH; expr(Assign);
if (tk == ']') next(); else { printf("%d: close bracket expected\n", line); exit(-1); }
if (t > PTR) { *++e = PSH; *++e = IMM; *++e = sizeof(int); *++e = MUL; }
else if (t < PTR) { printf("%d: pointer type expected\n", line); exit(-1); }
*++e = ADD;
*++e = ((ty = t - PTR) == CHAR) ? LC : LI;
}
else { printf("%d: compiler error tk=%d\n", line, tk); exit(-1); }
}
}

void stmt()
{
int *a, *b;

if (tk == If) {
next();
if (tk == '(') next(); else { printf("%d: open paren expected\n", line); exit(-1); }
expr(Assign);
if (tk == ')') next(); else { printf("%d: close paren expected\n", line); exit(-1); }
*++e = BZ; b = ++e;
stmt();
if (tk == Else) {
*b = (int)(e + 3); *++e = JMP; b = ++e;
next();
stmt();
}
*b = (int)(e + 1);
}
else if (tk == While) {
next();
a = e + 1;
if (tk == '(') next(); else { printf("%d: open paren expected\n", line); exit(-1); }
expr(Assign);
if (tk == ')') next(); else { printf("%d: close paren expected\n", line); exit(-1); }
*++e = BZ; b = ++e;
stmt();
*++e = JMP; *++e = (int)a;
*b = (int)(e + 1);
}
else if (tk == Return) {
next();
if (tk != ';') expr(Assign);
*++e = LEV;
if (tk == ';') next(); else { printf("%d: semicolon expected\n", line); exit(-1); }
}
else if (tk == '{') {
next();
while (tk != '}') stmt();
next();
}
else if (tk == ';') {
next();
}
else {
expr(Assign);
if (tk == ';') next(); else { printf("%d: semicolon expected\n", line); exit(-1); }
}
}

int main(int argc, char **argv)
{
int fd, bt, ty, poolsz, *idmain;
int *pc, *sp, *bp, a, cycle; // VM registers
int i, *t; // Temps

--argc; ++argv;
if (argc > 0 && **argv == '-' && (*argv) == 's') { src = 1; --argc; ++argv; }
if (argc > 0 && **argv == '-' && (*argv) == 'd') { debug = 1; --argc; ++argv; }
if (argc < 1) { printf("usage: c4 file ...\n"); return -1; }

if ((fd = open(*argv, 0)) < 0) { printf("could not open(%s)\n", *argv); return -1; }

poolsz = 256 * 1024; // Arbitrary size
if (!(sym = malloc(poolsz))) { printf("could not malloc(%d) symbol area\n", poolsz); return -1; }
if (!(le = e = malloc(poolsz))) { printf("could not malloc(%d) text area\n", poolsz); return -1; }
if (!(data = malloc(poolsz))) { printf("could not malloc(%d) data area\n", poolsz); return -1; }
if (!(sp = malloc(poolsz))) { printf("could not malloc(%d) stack area\n", poolsz); return -1; }

memset(sym, 0, poolsz);
memset(e, 0, poolsz);
memset(data, 0, poolsz);

p = "char else enum if int return sizeof while "
"open read close printf malloc memset memcmp exit void main";
i = Char; while (i <= While) { next(); id = i++; } // Add keywords to symbol table
i = OPEN; while (i <= EXIT) { next(); id = Sys; id = INT; id = i++; } // Add library to symbol table
next(); id = Char; // Handle void type
next(); idmain = id; // Keep track of main

if (!(lp = p = malloc(poolsz))) { printf("could not malloc(%d) source area\n", poolsz); return -1; }
if ((i = read(fd, p, poolsz - 1)) <= 0) { printf("read() returned %d\n", i); return -1; }
p = 0;
close(fd);

// Parse declarations
line = 1;
next();
while (tk) {
bt = INT; // Basetype
if (tk == Int) next();
else if (tk == Char) { next(); bt = CHAR; }
else if (tk == Enum) {
next();
if (tk != '{') next();
if (tk == '{') {
next();
i = 0;
while (tk != '}') {
if (tk != Id) { printf("%d: bad enum identifier %d\n", line, tk); return -1; }
next();
if (tk == Assign) {
next();
if (tk != Num) { printf("%d: bad enum initializer\n", line); return -1; }
i = ival;
next();
}
id = Num; id = INT; id = i++;
if (tk == ',') next();
}
next();
}
}
while (tk != ';' && tk != '}') {
ty = bt;
while (tk == Mul) { next(); ty = ty + PTR; }
if (tk != Id) { printf("%d: bad global declaration\n", line); return -1; }
if (id) { printf("%d: duplicate global definition\n", line); return -1; }
next();
id = ty;
if (tk == '(') { // Function
id = Fun;
id = (int)(e + 1);
next(); i = 0;
while (tk != ')') {
ty = INT;
if (tk == Int) next();
else if (tk == Char) { next(); ty = CHAR; }
while (tk == Mul) { next(); ty = ty + PTR; }
if (tk != Id) { printf("%d: bad parameter declaration\n", line); return -1; }
if (id == Loc) { printf("%d: duplicate parameter definition\n", line); return -1; }
id = id; id = Loc;
id = id; id = ty;
id = id; id = i++;
next();
if (tk == ',') next();
}
next();
if (tk != '{') { printf("%d: bad function definition\n", line); return -1; }
loc = ++i;
next();
while (tk == Int || tk == Char) {
bt = (tk == Int) ? INT : CHAR;
next();
while (tk != ';') {
ty = bt;
while (tk == Mul) { next(); ty = ty + PTR; }
if (tk != Id) { printf("%d: bad local declaration\n", line); return -1; }
if (id == Loc) { printf("%d: duplicate local definition\n", line); return -1; }
id = id; id = Loc;
id = id; id = ty;
id = id; id = ++i;
next();
if (tk == ',') next();
}
next();
}
*++e = ENT; *++e = i - loc;
while (tk != '}') stmt();
*++e = LEV;
id = sym; // Unwind symbol table locals
while (id) {
if (id == Loc) {
id = id;
id = id;
id = id;
}
id = id + Idsz;
}
}
else {
id = Glo;
id = (int)data;
data = data + sizeof(int);
}
if (tk == ',') next();
}
next();
}

if (!(pc = (int *)idmain)) { printf("main() not defined\n"); return -1; }
if (src) return 0;

// Setup stack
sp = (int *)((int)sp + poolsz);
*--sp = EXIT; // Call exit if main returns
*--sp = PSH; t = sp;
*--sp = argc;
*--sp = (int)argv;
*--sp = (int)t;

// Run...
cycle = 0;
while (1) {
i = *pc++; ++cycle;
if (debug) {
printf("%d> %.4s", cycle,
&"LEA ,IMM ,JMP ,JSR ,BZ ,BNZ ,ENT ,ADJ ,LEV ,LI ,LC ,SI ,SC ,PSH ,"
"OR ,XOR ,AND ,EQ ,NE ,LT ,GT ,LE ,GE ,SHL ,SHR ,ADD ,SUB ,MUL ,DIV ,MOD ,"
"OPEN,READ,CLOS,PRTF,MALC,MSET,MCMP,EXIT,");
if (i <= ADJ) printf(" %d\n", *pc); else printf("\n");
}
if (i == LEA) a = (int)(bp + *pc++); // Load local address
else if (i == IMM) a = *pc++; // Load global address or immediate
else if (i == JMP) pc = (int *)*pc; // Jump
else if (i == JSR) { *--sp = (int)(pc + 1); pc = (int *)*pc; } // Jump to subroutine
else if (i == BZ) pc = a ? pc + 1 : (int *)*pc; // Branch if zero
else if (i == BNZ) pc = a ? (int *)*pc : pc + 1; // Branch if not zero
else if (i == ENT) { *--sp = (int)bp; bp = sp; sp = sp - *pc++; } // Enter subroutine
else if (i == ADJ) sp = sp + *pc++; // Stack adjust
else if (i == LEV) { sp = bp; bp = (int *)*sp++; pc = (int *)*sp++; } // Leave subroutine
else if (i == LI) a = *(int *)a; // Load int
else if (i == LC) a = *(char *)a; // Load char
else if (i == SI) *(int *)*sp++ = a; // Store int
else if (i == SC) a = *(char *)*sp++ = a; // Store char
else if (i == PSH) *--sp = a; // Push

else if (i == OR) a = *sp++ | a;
else if (i == XOR) a = *sp++ ^ a;
else if (i == AND) a = *sp++ & a;
else if (i == EQ) a = *sp++ == a;
else if (i == NE) a = *sp++ != a;
else if (i == LT) a = *sp++ < a;
else if (i == GT) a = *sp++ > a;
else if (i == LE) a = *sp++ <= a;
else if (i == GE) a = *sp++ >= a;
else if (i == SHL) a = *sp++ << a;
else if (i == SHR) a = *sp++ >> a;
else if (i == ADD) a = *sp++ + a;
else if (i == SUB) a = *sp++ - a;
else if (i == MUL) a = *sp++ * a;
else if (i == DIV) a = *sp++ / a;
else if (i == MOD) a = *sp++ % a;

else if (i == OPEN) a = open((char *)sp, *sp);
else if (i == READ) a = read(sp, (char *)sp, *sp);
else if (i == CLOS) a = close(*sp);
else if (i == PRTF) { t = sp + pc; a = printf((char *)t, t, t, t, t, t); }
else if (i == MALC) a = (int)malloc(*sp);
else if (i == MSET) a = (int)memset((char *)sp, sp, *sp);
else if (i == MCMP) a = memcmp((char *)sp, (char *)sp, *sp);
else if (i == EXIT) { printf("exit(%d) cycle = %d\n", *sp, cycle); return *sp; }
else { printf("unknown instruction = %d! cycle = %d\n", i, cycle); return -1; }
}
}

[ Last edited by zzz19760225 on 2016-12-4 at 00:33 ]
1<词>,2,3/段\,4{节},5(章)。
Floor 11 Posted 2016-06-26 18:38 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
1
Learning Low-Level Programming: Write a C Language Compiler by Yourself
http://blog.jobbole.com/77305/

[ Last edited by zzz19760225 on 2016-12-4 at 01:03 ]
1<词>,2,3/段\,4{节},5(章)。
Floor 12 Posted 2016-06-26 18:38 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
Learn Programming Language Editor

Learn Programming Language is a Chinese version of the C language, specifically a superset of C language that supports Chinese code. It consists of a complete set of programming syntax and supporting tools.

Chinese Name: 习语言 (Xi Yu Yan)
English Name: The Learn Programming Language
File Extensions: 习, 接口 (Xi, Jie Kou)

Table of Contents
1. Introduction
2. Simple Examples
3. Versions
4. Acquisition Methods
5. Series Works

Introduction Editing

Learn Programming Language is a Chinese version of the C language, consisting of a complete set of programming syntax and supporting tools. It aims to popularize programming, make it more accessible, and localize it in Chinese. It is suitable as an entry-level learning tool for beginners.

As a Chinese programming language, all keywords and functions in Learn Programming Language are in Chinese. Learn Programming Language has fully supported assembly and C language and is developing towards Windows graphics processing.

Historical experience has shown that most code written in English will be forgotten over time. However, Learn Programming Language avoids this problem. Code can be recalled by browsing in Chinese, which truly fits the characteristics of the Chinese language. It also supports full-width punctuation marks, so there is no need to frequently switch when entering symbols during programming.

Chinese C (Learn) Language Chinese Programming System (referred to as: Learn Programming Language): is a Chinese programming software system mainly used for education and learning. It is implemented based on the existing C language system with expansions. The characteristics are as follows:
1. Fully supports all-Chinese programming, with all code in Chinese and all filenames in Chinese.
2. Integrated the advantages of PASCAL and C, supporting statement blocks enclosed by "开始" ("Start") and "结束" ("End"). Supports more comment methods, facilitating program organization.
3. Supports intuitive representation of multi-byte characters. For example, '我' ('I'), 'abcd' can both be used as characters.
4. Supports Chinese punctuation marks, and mixed use of Chinese and English punctuation marks, etc.
5. Supports program organization in an article-like manner, embedding program code directly in a Chinese article for compilation.
6. Supports Chinese character operators and mixed use of full-width and half-width characters.
7. Small in size, with very few interface files, easy to understand and use.

Purpose: Use Chinese to write C language programs and C language-based operating systems.

Simple Examples Editing

The following is a simple window example to experience the charm of Learn Programming Language:

#Include "习语言系统.接口" ("Xi Yu Yan System. Interface")
#Include "习语言视窗.接口" ("Xi Yu Yan Window. Interface")

【 主程序 】 ("Main Program")

Integer Type Main Function (Integer Type Parameter Count, Character Type *Parameter List)
{
Graphics Initialize Display (Null Pointer, 320, 240, Null Pointer, 0, Null Pointer);
Graphics Open Display();
Graphics Output Text (10, 30, "春眠不觉晓,处处闻啼鸟!" ("Spring sleep, I don't wake up, everywhere I hear birds singing!"));
Graphics Output Text (10, 200, "按任意键退出" ("Press any key to exit"));
Get Key();
Graphics Close Display();
Return 0;
}

Effect Picture:

Versions Editing

Introduction

Learn Programming Language Version 4715-3.6
Learn Programming Language Version 4714
Learn Programming Language Version 2014

Historical Revisions:

Learn Programming Language 3.6 Revision
1. Optimize the Learn library and improve support for multi-window drawing.
2. Optimize the Learn Programming Language editor, supporting shortcuts CTRL+F8, CTRL+F9 to compile and run the current file with or without a project.
3. Support F8, F9 shortcuts to view the output content back and forth.
4. Increase collaboration with Xi Jie, allowing writing Xi Jie statements in the Learn Programming Language editor and directly sending them to Xi Jie for running.
5. Add functions in the Learn library to recognize and process simplified and traditional Chinese numbers, as well as Suzhou numerals, etc.

Learn Programming Language 3.5 Revision
1. Support logical expressions such as "如果...就..." ("If... then..."), "或者...就..." ("Or... then..."), "否则..." ("Else...").
2. Support logical expressions such as "重复...直到..." ("Repeat... until...").
3. Support logical expressions such as "重复...当..." ("Repeat... while...").
4. Support logical expressions such as "当...重复..." ("While... repeat...").
5. Support branch statement expressions such as "检查...{若等于…}" ("Check... {If equal to...}").
6. Improve the Learn Programming Language editor, supporting dynamically adding custom vocabulary and statements (select text, right-click menu: Append -> Add to Vocabulary; Append -> Add to Quick Phrase List).
7. Fix the abnormal processing of the compiler for program statements like "无类型 甲;" ("No type Jia;"), "无类型 *猫;" ("No type *Mao;"), "甲=*猫;" ("Jia=*Mao;").
8. Support file compilation option settings in the Learn Programming Language editor environment.
9. Support project compilation settings and compile the entire project.
10. Support compiling the material files related to the file directly during compilation.
11. Improve support for Simple Learn.

Learn Programming Language 3.4 Revision
1. Adjust the toolbar of the Learn Programming Language editor and fix the problems found in the menu.
2. The variable, letter, type, and operator toolbars can be configured to be closed (not supported in the trial version).
3. Add support for the syntax "如果...就..." ("If... then...").

Learn Programming Language 3.3 Revision
1. Improve support for compilation settings. Select "Settings..." in the "Project" menu to set the compilation options of the file.
2. Modify and expand the format dialog of the Learn Programming Language editor, adding common word input.
3. Improve the sidebar content according to the feedback of Learn Programming Language 2016 version.
4. Fix the problem that no error is reported when a function has no parameters but 1 parameter is actually passed.
5. Improve the graphics programming-related functions.

Learn Programming Language 3.2 Revision
1. Improve the support for Simple Learn code.
2. Improve the Learn Programming Language editor.
3. Organize and improve the vocabulary list in the sidebar, and the classification is currently clearer and easier to understand.

Learn Programming Language 3.1 Revision
1. Fix the array pointer compilation error problem:
Integer (*数);
Integer 符 = {1,2,3,4,5 }, 小明;
数 = &符;
小明 = (*数);
2. Improve the serial port function, making serial port programming more convenient.
3. Improve the alias processing, and fix the compilation error problem when using an alias in the definition of a pointer member in a structure type.
4. Improve the array processing, and fix the problem that the initialization is incorrect when the array is defined using an interval. For example:
Integer Type 月份天数 = {31,28,31,30};
5. Organize and improve the organization of window functions in the sidebar vocabulary list, and the classification is clearer.
6. Recompile and generate the entire compiler to solve the 360 false positive problem.
7. Support binary constant representation, and its representation methods are: 0b101101, 0B101101, 0二101101, 101101b, 101101B, 101101二. All six representation methods are acceptable and have the same effect.

Learn Programming Language 3.0 Revision
1. Add serial port operation functions to support simple serial port communication programming.
2. Improve other known problems.

Learn Programming Language 2.9 Revision
1. Modify the implementation code of the input string function and fix the abnormal problem when using it on the WIN10 platform.
2. After selecting a vocabulary in the editing area, add a quick search function in the right-click menu.

Learn Programming Language 2.8 Revision
1. Improve vocabulary hints.
2. Fix the processing of %词 in the format output.
3. Improve the Learn Programming Language editor, and the sidebar is opened by default.

Learn Programming Language 2.71 Revision
1. Add the graphic mode file opening function.
2. Improve the program exit processing.
3. Improve the Learn Programming Language editor, and the sidebar is opened by default.

Learn Programming Language 2.7 Revision
1. Add and improve graphic processing functions.
2. Fix an error when the compiler processes complex multiplication and division expressions.
3. Add several time functions and classify and organize the functions in the sidebar.

Learn Programming Language 2.61 Revision
1. Add dialog box control operation functions.
2. Optimize the window function list.
3. Add support for new dialog box programs.
4. Add new program templates.

Learn Programming Language 2.6 Revision
1. Fix the problem of incomplete commercial version release.
2. Improve the Learn Programming Language editor and add the line limit for the output window.
3. Improve the environment configuration and sample programs.
4. The commercial version better supports VC header files and libraries.
5. Add preprocessing instructions.

Learn Programming Language 2.5 Revision
1. Organize and improve graphic functions and optimize the graphic driver.
2. Add functions such as console opening and closing, graphic pause, triangle drawing, flood fill, etc.
3. Organize and optimize function classification and prompt information.
4. Organize and implement more program templates.
5. Add message processing macros to implement a message processing framework.

Learn Programming Language 2.4 Revision
1. Improve the multi-file search processing in the Learn Programming Language editor, browse the output information back and forth, and backtrack and forward the edit position.
2. Improve the graphic refresh display function. While refreshing, refresh the interface display and process all pending event messages.
3. Improve the comment information of some functions, making it more understandable and clear.
4. Add the function "控制台设置文本颜色" ("Console Set Text Color").
5. Support the interface file of windows.h, allowing compilation and running of original WIN32 code, as well as mixed Chinese and English compilation.
6. Optimize the Learn Programming Language compiler, and the error information is more convenient to locate.

Learn Programming Language 2.3 Revision
1. Change the function name "文件结束" ("File End") to "文件已结束" ("File Has Ended"), and "文件出错" ("File Error") to "文件已出错" ("File Has Errored").
2. Improve the explanation of some functions.
3. Improve the processing of dynamic library export functions to achieve full Chinese support.
4. Improve the Learn Programming Language editor, support displaying the startup path in the version information, facilitating distinguishing which version is running when multiple versions coexist.

Learn Programming Language 2.2 Revision
1. Fix the problem that the window program compiled and linked with the console in version 2.1 runs incorrectly.

Learn Programming Language 2.1 Revision
1. Improve the Learn Programming Language editor. After right-clicking in the Help - Version Information window, the Learn Programming Language editor is automatically associated with.习 files and can be double-clicked to open.
2. Improve the system functions and interface files, and the function prompt content.

Learn Programming Language 2.02 Revision
1. Improve the pointer table function.
2. Improve the memory operation function, change allocation to application, because from the program perspective, it is applying for memory, and from the memory management perspective, it is allocation.
3. Improve the back and forth positioning function of the Learn Programming Language editor (the functions of previous position and next position).

Learn Programming Language 2.01 Revision
1. Improve 习语言.exe, enhancing the fault tolerance for various different command line parameters when compiling assembly code.
2. Modify the processing of richedit to support richedit.

Learn Programming Language 2.0 Revision
1. Improve the drawing function.
2. Improve the Learn Programming Language editor, support full function name display, support Chinese symbols, and multi-line input of Chinese characters.
3. Improve system functions, types, and macros.
4. Integrate the Learn Programming Language usage tutorial.
5. Integrate the VC6 linker.
6. Add "Tetris and Snake source code".
7. Add the visual IDE of Hua Xin Luo Bo and its video tutorial.

Learn Programming Language 1.86.1 Revision
1. Improve the fault tolerance of the national standard string function for characters.
2. Modify the method of the Learn Programming Language compiler to support wide characters.
3. Beautify the system icon.

Learn Programming Language 1.86 Revision
1. Improve the window function list.
2. Improve the Learn Programming Language editor, and the run command supports shortcuts.

Learn Programming Language 1.85.9 Revision
1. Improve the system function list.
2. Improve the Learn Programming Language editor.

Learn Programming Language 1.85.8 Revision
1. Improve the system function. Discard all 1.85 branch versions before 1.85.6.
2. Improve the sidebar vocabulary hint.
3. Update "习语言.exe" to support the "编译.设置" ("Compile.Settings") file.
4. Optimize support for resources and add support for menus.
5. Optimize the Learn Programming Language editor to support the memory of the new file save path.
6. Improve the control style.

Learn Programming Language 1.85.6 Revision
1. Fix a memory access exception problem introduced in the system library function in version 1.85. Discard the last few 1.85 branch versions before 1.85.6.
2. Organize and improve the graphics and window functions of Learn Programming Language, and classify and organize the function list. Change some function names.
3. Improve the graphic processing interface function, support drawing pictures without a background, and support saving the content as a picture.
4. Improve the Learn Programming Language editor.

Learn Programming Language 1.85.5 Revision
1. Improve the Learn Programming Language compiler to support #编译指令 对齐(入栈, 2) ("#Compile Directive Align(Enter Stack, 2)").
2. Improve the Learn Programming Language editor.
3. Organize and improve the graphics and window word library and interface of Learn Programming Language.

Learn Programming Language 1.85 Revision
1. Organize and improve the national standard string function.
2. Improve the graphic format input function.
3. Optimize the hint word library.
4. Optimize the sidebar vocabulary automatic input function of the Learn Programming Language editor, providing an optional option of whether to have hints.
5. Optimize the Learn Programming Language compiler and add support for keywords: 检查 ("Check"), 加载 ("Load").
6. Optimize and organize time-related functions.
7. Correct and improve the linked list function and expand the function of graphic input string.

Learn Programming Language 1.82 Revision
1. Improve the vocabulary hint function of the Learn Programming Language editor.
2. Improve the hint word library.
3. Optimize the system library function.
4. Support a simpler graphic programming.

Learn Programming Language 1.80 Revision
1. Remove the comments in the automatically input vocabulary in the sidebar.
2. Improve the quick input function.
3. Optimize the Learn standard library and reduce the size of the executable program.

Learn Programming Language 1.78 Revision
1. Support first letter abbreviation quick input.
2. Add a small number of functions.
3. Improve the sidebar vocabulary.

Learn Programming Language 1.76 Revision
1. Support PASCAL assignment operator.
2. Support array representation syntax starting from 1.
3. Improve the system function.

Learn Programming Language 1.75 Revision
1. Add multiple output windows.
2. Improve the function help display.
3. Variable names support GB18030 characters (early versions supported GB2312).
4. Support DLL implicit call (only supported in the commercial version).

Learn Programming Language Version 1.72 Revision
1. Expand some practical functions.
2. Support multimedia interfaces such as direct picture display and sound playback.

Learn Programming Language Version 1.71 Revision
1. Add dynamic library function declaration call macros to simplify dynamic library access.
2. Solve the decimal type input error problem found in the previous version.
3. Add graphic format output and graphic input functions, facilitating migrating all console programs to graphic programs.
4. Optimize the window function, add a large number of window functions, making it more convenient to draw various controls and facilitating the writing of window programs.
5. Add support for resources in the editor environment.

Learn Programming Language Version 1.70 Revision
1. Improve the compilation environment, using tools written in Learn Programming Language to replace the original batch processing.
2. Support dynamic pointer arrays and linked lists, and improve filename processing.
3. Optimize the editor to adapt to entering English symbols in Chinese state.
4. Improve the vocabulary function list, and clicking can realize multi-line code input.
5. Support function aliases and support Chinese periods as statement endings.
6. Improve the Learn Programming Language program design document.

Learn Programming Language Version 1.69 Revision
1. Improve the compiler and add the pure assembly code generation function, added in response to the development needs of xl-os.
2. Add a Learn Programming Language vocabulary tree in the editor to realize quickly adding vocabulary to the editing area.

Learn Programming Language Version 1.68 Revision
1. Improve the compiler and optimize code generation.
2. The entries are a bit many, omitted...

Learn Programming Language Version 1.66 Revision
1. Fine-tune the operator precedence to be more in line with thinking habits.
2. Fix the error in handling when the floating point is initialized as a negative number.
3. Correct the window example according to the changes of the latest version.

Learn Programming Language Version 1.65 Revision
1. Continue to improve the floating point processing problem.
2. Strictly function calls, no longer allowing direct call of functions without declaration.

Learn Programming Language Version 1.62 Revision
1. Fix the floating point processing problem.
2. Add support for the main function name.
3. Improve Chinese prompts.
4. Support direct compilation of C code.

Learn Programming Language Version 1.6 Revision
1. Improve the processing of standard call and C call.
2. Fix the floating point operation error.
3. Add Chinese commands.
4. Add commands for mutual conversion between C and Learn Programming Language.

Learn Programming Language Version 1.5 Revision
1. Update the Learn Programming Language editor, adding a prompt to open or create a new one when starting to run.
2. Organize the system function interface definition and improve the function comments.
Uniformly place the file handle of the file reading and writing function as the first parameter.
Uniformly read character as reading a single-byte English character, and read word as reading a single-byte English character or Chinese character.
3. Support file opening and saving functions, support dialog box creation, control creation, etc., for graphic programming.
4. Correct a few errors in Zhonghui.

Summary of the results of the next stage:
1. Complete Learn Programming Language that supports all Chinese, generating all-Chinese written assembly code (X86).
2. Complete an assembler that supports all-Chinese assembly (X86). Generate object code compatible with Microsoft format. Connecting with Microsoft's linker can generate console programs and window programs on WINDOWS.
3. Complete the all-Chinese standard Learn Programming Language function library. Can support basic console and graphic programming.
4. Complete a build tool (equivalent to make) that supports all-Chinese construction instructions (equivalent to makefile).
5. Complete an editor that supports Chinese syntax highlighting, can support syntax highlighting and editing of Learn Programming Language source programs and construction instructions, and integrated compilation of Learn Programming Language source programs.
6. Complete the basic tutorial of Learn Programming Language.

Ongoing work:
1. Develop supporting tools related to Learn Programming Language.
Version 1.4 has greatly improved in ease of use and solved some discovered problems.
There is already version 1.5, which supports Windows graphic design.
As of May 2012, the latest version is 1.76.
It can be compatible with c/c++ by adding the function library.
However, there are a few points to note when using it: first compile and then run, and the compilation methods of console programs and graphic modes are different. You need to click two different compile buttons respectively. The left one is the console button, and the right one is the graphic mode compile button. The general mode compile button is Run, then Run with parameters, and then Run Capture (the text output when the program runs will be displayed above the output panel below).
Currently developing the function of automatically compiling and running directly by clicking Run.

Acquisition Methods Editing

Learn Programming Language Version 1.82 can be downloaded on major download websites. Search "习语言 下载" ("Learn Programming Language Download") on Baidu to obtain the download link, and it can also be obtained through forums, WeChat groups, and doing related tasks.

Series Works Editing

Learn Programming Language - Chinese Extension Library for C Language
Xi Jiajia - Chinese C++ Development Companion
Xi Lini - Chinese Extension Library for Programming under the Linux System
Xi 51 - Chinese Development Companion for 51 Single-Chip Microcomputer
Zhonghui - Chinese X86 Assembly
Chinese Build Tool (Chinese Version of the make Tool)

[ Last edited by zzz19760225 on 2017-6-12 at 01:37 ]
1<词>,2,3/段\,4{节},5(章)。
Floor 13 Posted 2016-06-26 18:39 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
linux gcc
dos Turbo C

Tools are just an equipment. The one who uses the tool and finds the direction to use the tool is one and the same.


Computer Terms
Synonyms
Favorites
Share
tc
Edit Entry
外文名 Turbo C
Belongs to Computer Term
Contents
1 Basic Content
2 Function Introduction
3 Other Terms
1 Basic Content Editing
Turbo C integrated development environment is a set of C language development tools developed by Borland. It integrates multiple functions such as program editing, debugging, and linking. In the DOS system era, Turbo C was the most widely used PC application development tool, and many application software were developed with Turbo C. With the development of computers and their software, the operating system has developed from DOS to Windows. Most application software under the Windows system no longer uses Turbo C for development. However, as an excellent C program development tool, it is still an ideal tool for learning C programming. The following mainly introduces the widely used version 2.0.

2 Function Introduction Editing
  The Turbo C integrated development environment mainly provides the following functions:

  1. File Management Function

  Turbo C provides basic functions such as creating, saving, closing, and opening source program files. With these functions, you can complete a series of operations from creating to saving and opening C program files.

  2. Editing Function

  Turbo C mainly provides basic editing functions such as text selection, insertion, deletion, and search.

  3. Compilation/Linking Function

  All C language source programs are stored in text (ASCII) form. They must go through syntax analysis, checking, and translation before they can form binary instructions that the computer can recognize. The compiled program is generally called object code. In the program design process, function libraries are often used. Therefore, it is generally after linking the object code and the object code in the function library that the binary instruction program that the computer can recognize is truly formed.

  4. Running/Debugging Function

  In the program design process, some errors are inevitable. Therefore, they must be verified by running before they can be delivered for use. The compilation stage mainly performs syntax analysis and checks for errors, while the running stage mainly checks for logical errors in the program. In order to facilitate checking logical errors in the program, most compilers generally provide debugging functions to track the running process and state of the program. Turbo C mainly provides functions such as single-step execution, tracing, breakpoint management, and expression calculation.

  5. Project Management Function

  In the process of software development, a software may require multiple people to edit hundreds or thousands of program files, forming code of hundreds of thousands of lines or more. To manage such a large-scale software development, project management must be used. The project management function provided by Turbo C mainly controls the compilation and linking of code.

  6. System Settings and Help

  In order to ensure the normal operation of the system and set parameters such as compilation and linking, Turbo C provides relevant system parameter setting functions. In addition, in order to help beginners master the use of Turbo C, the system provides rich help information. The main way to obtain help information is to press the function key F1 when in need of help.

3 Other Terms Editing
  TC (Transmission Convergence) transmission convergence sublayer. Provides a unified interface with the ATM layer.

  TC, short for TurboCache. NVIDIA's TurboCache (referred to as TC) technology is of great significance in building the cost-performance ratio of new-generation products. It provides the latest GPU architecture and various forward-looking applications while taking into account cost. TurboCache is a patented hardware and software technology. TurboCache seizes the opportunity of the replacement of new and old buses and gives full play to the advantages of PCI-Express bandwidth.

  TC, short for Traffic Control. It is a tool for traffic control in Linux. Through tc, the rate at which network interfaces send and receive data can be controlled.

  TC, short for Total Commander. Total Commander, referred to as TC, formerly Windows Commander, is a powerful all-in-one file manager.

  TC, short for TopCoder. This website can be said to be a website for programming competitions, but the question types and competition forms are very different from ACM/ICPC. This website includes China in its competition area. Everyone can go there to communicate more directly with programmers from all over the world (in fact, most are also college students). It may also be a good place to train for ACM/ICPC.

  Short for Thin Client. A thin client (Thin Client) is a small industry-specific commercial PC designed based on PC industry standards that uses a professional embedded processor, a small local flash memory, and a slim version of the operating system. The configuration includes a professional low-power, high-computing-function embedded processor. The local flash memory that irreversibly stores the operating system, as well as the standard input/output options for local system memory, network adapter, graphics card, and other peripherals. Thin clients have no removable parts and can provide a more secure and reliable use environment than ordinary PCs, as well as lower power consumption and higher security.

-------------------------------------------------------------------------------------------------------------------------------------------------
When Turbo C starts to execute, it first waits for you to press any key. When you press any key, Turbo C will move the cursor to the File item in the main menu. At this time, if you want to use the editor, you can move the cursor to Edit, then press the Enter key, or directly press E or e. After you perform the above actions, the screen will look exactly the same as shown in the figure. There is a highlighted editor status bar at the top of the editing window. The text in this line is used to tell you the status of the editor and the name of the file you are currently editing. The first two items, Line and Col, are used to display the current line number and column number where the cursor is located. Insert is used to tell you that the current editor is in the text insertion state. That is, when you enter text, Turbo C will insert the text you entered into the original existing text. The mode opposite to the Insert mode is overwrite. In this operation mode, the newly entered text will replace the text at the position where the cursor is located. You can use the INS key to switch between these two modes. In most cases, you will use the original set INSERT mode because this mode is the most commonly used. The INDENT information prompts you that the current editor is working in the automatic formatting mode. Wait a while, and you will see how the automatic formatting mode works. When you don't want to use the automatic formatting mode, just enter CTRL+O+I. Later, if you want to use the automatic formatting mode again, just enter CTRL+O+I again. The Tab information is used to tell you that you can use the TAB key to perform tabbing. You can use CTRL+O+T to turn this function on and off. The last item of information on the editor status bar is the name of the program you are currently editing. When we start executing TURBO C, we can set the name of the program file we are going to edit in the command. This will be introduced later. Because so far, you have not set the file name of the program to be edited, so TRUBO C uses the pre-set name NONAME.C.

---------------------------------------------------------------------------------------------------------------------------------------------------
Once you enter the editing window, it is ready to receive text. So you can enter the following text:
Roses are red
violets are blue
and so will you.

After you enter the last line of text, don't forget to press Enter. If you type any wrong characters, you can use the backspace key to correct the wrong characters. Now your screen looks like Figure 3.2. In Figure 3.2, please pay attention to the position of the cursor and the numbers next to LINE and COL.

You can use the cursor keys to move the cursor. Now use the cursor keys to move the cursor to the far left of the line "and so will you". Then you enter "I like Turbo C" and press Enter. When you type, please carefully observe how Turbo C moves the original entered line of text to the right. This is what the editor does in the insertion state. If you change the editor to the Overwrite state, Turbo C will overwrite the original line of text. Now the screen looks like Figure 3.3.

[ Last edited by zzz19760225 on 2016-12-11 at 16:40 ]
1<词>,2,3/段\,4{节},5(章)。
Floor 14 Posted 2016-06-26 18:40 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
Can the C language decompose into a mode where bit-interpretation language and compilation are combined and can be freely selected?

nim vala

[ Last edited by zzz19760225 on 2017-7-13 at 05:47 ]
1<词>,2,3/段\,4{节},5(章)。
Floor 15 Posted 2016-06-26 18:41 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
Practice:
1. Display a paragraph through the gcc in the linux terminal:

Concentrate on this paragraph to familiarize yourself with its words, structure, extensions behind it, editor operations, machine code content, change different display contents, small articles and large articles, etc.

#include <stdio.h>
int main(void)
{
printf("")
return 0;
}


Assuming the encoding is correct, enter gcc filename and suffix in the terminal, confirm that the./a.out file will be generated, and directly enter this./a.out to display the file content.

2. Try writing wrong next time, the program writing in deformation, directly view the differences in the machine code of./a.out under different text contents.


#include <stdio.h>
int main(void)
{
printf("");
}




ugg:
It is easy to find the function list, such as "C~C++ Programmer's Practical Collection - Best Programming Guide for C~C++"
It is not easy to find the function source code. It can only be simulated and implemented, or viewed by disassembling.

[ Last edited by zzz19760225 on 2017-11-1 at 14:19 ]
1<词>,2,3/段\,4{节},5(章)。
1 2 3 6 Next ›
Forum Jump: