
Hey, prospective undergraduates preparing for advancement! How is your review going?
When it comes to C language, do you find yourself surrounded by a bunch of question marks: pointers twisting like a maze, program errors making your scalp tingle… Don’t panic, you’re not alone! C language is a “battleground” for advancement exams, both a focus and a challenge.
But have you ever thought about why major universities are so fond of C language? Because it is not only the “ancestor” of programming but also the “golden key” to understanding the underlying logic of computers! Mastering it will help you grasp “hard courses” like data structures and operating systems more quickly.
This article is here to help you “move mountains”! We will set aside thick textbooks and directly outline the core exam points,crack classic example questions, andavoid common pitfalls. We will guide you from “beginner to giving up” to “beginner to mastery”, making your path to advancement more stable! “
Starting today, the author will periodically update knowledge related to C language learned from the advancement institution.
First Lesson of C Language for Advancement: Basic Knowledge of C Language
01
—
Section 1: Programming Languages
Speaking of languages, what comes to mind? So what is a language? A language is actually a way of communication between one thing and another. In real life, people need language to communicate with each other, animals need language to communicate with each other, and similarly, there is a need to solve the language problem between humans and machines. The language that solves the communication between humans and machines is called a programming language.
So how do we communicate with machines? Clever humans have created a language that can be recognized by both computers and humans, which is the first generation language: machine language.
Machine language (Machine Language) is a programming language or instruction code that can be directly recognized by machines, requiring no translation. Each operation code has corresponding circuits within the computer to complete it, or refers to a programming language or instruction code that can be directly understood and accepted by machines without translation.
A single instruction is a statement in machine language, consisting of a meaningful set of binary codes, with the basic format of the instruction including the operation code field and the address code field, where the operation code specifies the nature and function of the instruction, and the address code provides the operand or the address of the operand.
Its emergence solved the core problem of transforming electronic computers from cumbersome physical machines that required manual configuration into automated, general-purpose problem-solving tools that could store and run programs. However, it also brought about an unsolvable problem:it is extremely difficult to read, memorize, and write (all 0s and 1s), and is very prone to errors.
I believe everyone has a simple understanding of machine language, and I will not elaborate further on it; just a brief overview will suffice.
Due to its extreme difficulty in reading, memorizing, and writing, the second generation language emerged: assembly language.
Assembly language (Assembly Language) is a low-level language used for any electronic computer, microprocessor, microcontroller, or other programmable devices, also known as symbolic language. In assembly language, mnemonics replace the operation codes of machine instructions, and address symbols or labels replace the addresses of instructions or operands.However, its drawbacks soon appeared: extremely low development efficiency, poor portability, difficult maintenance, and prone to errors. At this time, the emergence of the third generation language solved the above problems. It is the third generation language: high-level language.High-level languages (High-level programming languages) are machine-independent, process-oriented or object-oriented languages. High-level languages are designed to approximate everyday conversation, referencing mathematical language.High-level languages have higher readability compared to low-level languages and are easier to understand. Since the early development of the computer industry mainly took place in the United States, most high-level languages are based on English.Computer languages are divided into high-level and low-level languages. Low-level languages mainly include two types: machine language and assembly language. High-level languages are primarily defined in contrast to assembly language, as they are closer to natural language and mathematical formulas, essentially detached from the hardware system of machines, and written in a way that is easier for people to understand. The programs written are called source programs.High-level languages do not refer to any specific language but include many programming languages, such as popular languages like Java, C, C++, C#, Pascal, Python, Lisp, Prolog, FoxPro, Easy Language, and the Chinese version of C language (习语言), etc. The syntax and command formats of these languages vary.From an application perspective, high-level languages can be divided into basic languages, structured languages, and specialized languages. C language is a prominent representative of structured languages.From the perspective of programming paradigms, high-level languages can also be divided into process-oriented and object-oriented languages. C language is a very typical process-oriented programming language.Then the fourth generation language emerged: 4GL.Fourth-generation languages (Fourth-Generation Language, 4GL) are non-procedural programming languages characterized by allowing users to define “what to do” rather than “how to do it” through automatically generated processing steps.Its functions cover file design, query languages, non-procedural operation support, etc. Typical applications include database queries (like SQL) and application generators. Currently, the main programming languages used in the market are high-level languages, so fourth-generation languages will not be elaborated further; a brief overview will suffice.Above is the history of the development of programming languages. Next, we will discuss the content of this issue on C language for advancement:
- The birth of C language was in 1972, developed by Dennis Ritchie at Bell Labs.
- It is a process-oriented programming language.
- The three basic structures of C language programs are: sequential structure, selection structure (branch structure), and loop structure.
- Its characteristics are as follows:
- Concise and flexible
- Powerful functionality
- Efficient operation and widely used
02
—
Section 2: Basic Composition of C Language
Below is the basic framework of a C program:
#include <stdio.h> // Include standard input-output header file
void main(){ // Main function, program entry
printf("hello world!"); // Output function
}
1. Main function and user-defined functions
-
A function is an independent code unit designed to perform a specific task.
-
The basic element of a C program is a function; a C program must have one and only one main function (main function), which can contain zero or more user-defined functions.
2. Statements
-
Every statement in a C program must end with a semicolon ” ; “.
-
C programs can be written freely, allowing multiple statements on one line or multiple lines for one statement.
-
The input and output of C programs are implemented by functions.
Classification:
-
Simple statements
-
A single statement is a simple statement. It includes control statements, expression statements, function call statements, and empty statements.
-
Compound statements
-
Compound statements (also known as code blocks or block statements) are a group of statements enclosed in curly braces
<span>{}</span>and are treated as a single unit in syntax.
Comment symbols:
-
The comment symbols in C language are used to add explanatory text in the code, which the compiler ignores during compilation.
-
There are two common forms of comments:
-
Single-line comments: Single-line comments are made using double slashes.
-
Multi-line comments (quick comments): Multi-line comments are made using /* and */.
Compilation and execution:
-
The execution process of a C program includes: writing, compiling, linking, and executing. The execution process diagram is as follows:

-
C programs are compiled starting from the first line of the program until the last line ends.
-
C programs execute starting from the first line of the main function until the last line of the main function ends.
Identifiers:
-
Classification:
-
System identifiers
-
System identifiers are shown in the figure:

-
User identifiers
-
Naming rules:
-
Can only consist of letters, numbers, and underscores.
-
Must start with a letter or underscore, cannot start with a mathematical symbol.
-
Case-sensitive.
-
Cannot have the same name as a keyword.
-
Predefined identifiers: are identifiers predefined by the C language standard library, which programmers can use directly.
03
—
Section 3: Algorithms
Algorithms are a series of clear and precise instructions used to solve specific problems or complete specific tasks. Like a cooking recipe, it tells the computer “how” to solve the problem step by step.
The key characteristics of algorithms are:
-
Finiteness: Must terminate in a finite number of steps.
-
Determinacy: Each step has a clear meaning, with no ambiguity.
-
Input: Can have zero or more inputs.
-
Output: Must have at least one output.
-
Feasibility (Determinacy): Each step can be executed.
That concludes the content of the first chapter on C language for advancement. I hope this summary can serve as a “debug light” to illuminate the blind spots in your review.