Why Do C Language ‘Statements’ and ‘Assignments’ Confuse You? Teacher Frank Takes You to the Core of English Understanding!

Why Do C Language 'Statements' and 'Assignments' Confuse You? Teacher Frank Takes You to the Core of English Understanding!

In the last lesson, we discussed a lot of theory. Don’t find it boring; this information is very useful, but few people are willing to break it down and explain it like I do.

Many people learning programming find that the first hurdle is not the code itself, but being confused by a bunch of oddly translated technical terms. What about “statements,” “expressions,” “assignments”… Oh my, just hearing them makes one feel overwhelmed!

Today, let’s have a “stand-up comedy,” starting from the familiar hospital visit scenario, to thoroughly break through the “window paper” of these terms and let you see their true nature!

statement – not “语句” (sentence), but “指令” (instruction)!

In the last lesson, we mentioned that the main function is like the “outpatient hall” of a hospital, the entrance to your program. When you walk into this hall, every step you take, such as registering, undressing, placing your chest on the cold instrument, and holding your breath at the doctor’s command… in C language, these specific steps all have a professional term: statement.

In Chinese, it is usually translated as “语句” (sentence).

My goodness, imagine going to the hospital and the doctor says to you:“What I’m about to tell you are all ‘statements’.” Wouldn’t you be confused? It feels like you’re speaking in a foreign language.

Let’s take a look at how the authoritative Oxford Dictionary explains statement:

“Something that you say or write that gives information or opinion.”

Translated, it means:“Something you say or write that provides information or opinion/instruction.”

Now, isn’t it clear? When the doctor tells you to “undress,” that is a statement; it gives you a clear instruction. When they say, “Come back in 30 minutes for your results,” that is also a statement; it provides you with clear information.

So, stop thinking of it as a fancy “语句” (sentence)! In a function (specialty department), a statement is an independent operation instruction or step that needs to be executed. It is the smallest independent unit of operation in C language, just like a complete sentence in English that expresses a clear intention.

function – the “specialty department” in a hospital

After discussing statement, let’s look back at function. Many textbooks say: “Functions are the building blocks of C.” This translation is correct, but for beginners, it still feels a bit abstract.

Using our hospital analogy makes it much simpler:

C program ≈ the entire hospital

function ≈ various “specialty departments” in the hospital

The hospital provides the function of “taking X-rays,” which is a function. Providing the function of “checking ECG,” that’s another function. The entire hospital (C program) is composed of these various specialty departments (functions). Thinking of it this way makes it instantly clear, doesn’t it?

Declaration, Definition, Assignment– A new employee’s onboarding experience

Next is the main event, which is a major confusion area for countless beginners:declaration (声明), definition (定义), and assignment (赋值).

Let’s understand this through the story of hiring employees at the hospital:

1. Declaration (声明)

The hospital is short-staffed and posts a notice to hire. You go for an interview, and the steward looks at you,“Hmm, it’s a male,” so he lets you stand in the male line to wait.

In C language, this is called declaration.

int number; // This is a declaration

This line of code tells the compiler:“Hey, I have a variable called number, which is of type int. I might use it later, just so you know there’s this ‘person’.”

At this point, the compiler only knows its “type” (male or female), but hasn’t assigned it a formal position (memory space) or given it a specific employee number (value).

2. Definition (定义)

In Stephen Chow’s movie “The King of Comedy,” when the protagonist enters the hospital, even before being assigned a specific job, he is given the name “Hua An,” employee number “9527,” and identity “low-level servant.”

This process is called definition.

int number = 123; // This is a definition

Definition = declaration + allocate space + initialize value. It not only tells the compiler that there is a variable number of type int, but also immediately allocates memory space for it and puts the initial value of 123 into it. From this moment on, the identity of number is “set in stone.”

3. Assignment (赋值)

After being hired at the hospital, you first stand in the male line (declaration). After a while, the lady of the house comes out and points at you, saying:“You, from now on, will be called 9527, responsible for sweeping the floor.”

This “assignment of tasks” action is called assignment.

int number;      // Declaration (you report for duty)number = 123;  // Assignment (you have a specific task to do)

The word assignment itself means “task, job” in English. Therefore, the line of code number = 123; essentially gives the already existing variable number a clear “task” — your value is now 123.

See, putting these terms into specific scenarios makes it a thousand times easier than memorizing “declaration is… definition is…”!

[Professional Correction and Supplement] How many types of “statements” are there in C language?

In the video, Teacher Frank mentioned a confusion: Chinese materials say there are six types of statements in C language (label, compound, expression, selection, iteration, jump), while he saw English materials listing five types (declaration, assignment, function call, control, null).

What’s going on? Is one of them wrong?

Actually, neither is wrong! They just view “statements” from two different dimensions.

The classification method in Chinese materials (more common in textbooks) is based on “grammatical structure.”

  • Selection statement: that is if-else, switch, responsible for making choices.

  • Iteration statement: that is for, while, do-while, responsible for loops.

  • Jump statement: that is break, continue, goto, return, responsible for “jumping around.”

…and so on. This classification method focuses on what the statement looks like and its structure.

The English materials that Teacher Frank saw are based on “functional roles.”

  • Declaration statement:(declaration statement): int a; its role is to declare.

  • Assignment statement:(assignment statement): a = 10; its role is to assign.

  • Function call statement:(function call statement): printf(“Hello”); its role is to call a function.

So, this is a completely different classification of the same set of things, just like we can classify people as “men and women” (by gender), or “adults and children” (by age). Both are correct, just different perspectives. Understanding this will make your knowledge system more three-dimensional.

Control flow and null statement– Registration payment and “staying in place”

Finally, let’s discuss two interesting statements.

Control flow(Control)

What is control?

Using the hospital example again:

You go to the registration window, and there are three payment methods: WeChat, Alipay, cash.

You first scan WeChat and find you have no money. (Condition not met)

The process is controlled to the next step; you open Alipay and find you also have no money. (Condition still not met)

The process is again controlled to the next step, and you can only pay in cash.

This process of deciding which path the program should take based on conditions is called control flow. if-else is the most typical control flow statement.

Null statement(Null Statement)

In C language, there is the simplest statement, which looks like this:

; // This is a null statement (null statement)

Yes, it’s just a lonely semicolon. It represents “doing nothing.”

When would you use it? For example, if you want to write an infinite loop that makes the program “stay in place,” doing nothing but spinning in circles wasting time.

while (1) {    // Keep spinning, but doing nothing    // Just an empty statement    ; // Null statement can be placed here}

This is like a person who is constantly in internal conflict, looking busy, but actually producing nothing. Isn’t this analogy particularly vivid?

Alright, today’s “stand-up comedy” ends here. Through vivid analogies of hospital visits and employee onboarding, we have redefined those basic yet easily confused terms in C language:

  • Statement: Understand it as “instruction” or “step,” rather than “sentence.”

  • Function: Think of it as the “specialty department” in the big hospital of the program.

  • Declaration, Definition, Assignment: Use the process of “new employee reporting -> assigning employee number -> assigning tasks” to understand, and it becomes instantly clear.

  • Classification of statements: Understand the two different classification perspectives of “grammatical structure” and “functional role,” and no longer be confused.

When learning programming, especially C language, do not fall into the trap of Chinese translations. Think more about the original meanings of these terms in the English context, and combine them with vivid scenarios to understand. You will find that the world of programming is actually much simpler and more interesting than you think!

Why Do C Language 'Statements' and 'Assignments' Confuse You? Teacher Frank Takes You to the Core of English Understanding!

Leave a Comment