Proof that the main Function in C Language Can Only Have One Instance

Defining the same function in different C source filesIn general, to maintain the simplicity and efficiency of the program, it is not recommended to define the same function (with the same return type and parameter types) in different C source files. Otherwise, the compiler may throw an error indicating multiple definitions, as shown in the … Read more

How to Return Two or More Values from a Function in C Language

Multiple return valuesIn C language, a function can generally return only one value by default. So, how can we design a function to return two or more values?Example of a standard library functionBefore that, let’s recall a standard library function in C language that we previously introduced, ldiv(). This function can be used to perform … Read more

C Language Classroom: Relational Expressions

Today, we will explore an important concept that plays the role of a judge in programming—relational expressions. 1. Explanation of Knowledge Points 1. What is a Relational Expression? In C language, a relational expression is an expression used to compare the relationship between two values. It consists of two operands (which can be variables, constants, … Read more

Implementing a Simple HTTP Server in C Language

A teaching project, a simple HTTP server implemented in C language. github.com/mustafa-khann/http-server The project will be built from scratch, aiming to understand the principles of web servers and the HTTP protocol. Currently still in serialization, ✨ The first phase aims to implement: Single-threaded HTTP/1.1 server – handling one request at a time Support for GET … Read more

Writing Ruby Extension Libraries: Steps for Implementing C Language Extensions and Ruby Calls

Writing Ruby Extension Libraries: Steps for Implementing C Language Extensions and Ruby Calls In Ruby, while most development work can be accomplished with pure Ruby code, there are times when we need higher performance or access to low-level system resources. In such cases, we can use C language to write extension libraries. This article will … Read more

Differences Between char*, Character Arrays, and Dynamically Allocated Strings in C Programming

This is a very critical and often confused knowledge point in C language: <span>char*</span>, character arrays (such as <span>char str[]</span>), and the relationship between strings. Let’s thoroughly clarify their essence, differences, and connections. 1. Basic Concepts of the Three Term Meaning <span>char*</span> Character pointer, pointing to the address of one (or more) <span>char</span> type variables … Read more

Understanding Function Parameters and Arguments in C Language in One Sentence

Key Summary:After a function call, the operation is performed on the initialized parameter, not the argument!Function Parameters and ArgumentsIn C language, depending on the different states of the function, the parameters can be roughly divided into two categories: one is formal parameters, and the other is actual parameters.Formal parametersare the parameters declared in the function … Read more

Reverse Engineering of a Parameterless C Function with Return Value in 32-bit

Reverse Engineering of a Parameterless C Function with Return Value in 32-bit Below is a simple example of a C function that does not take any parameters but returns an integer value. Additionally, I provide step-by-step instructions for writing and viewing its assembly code using Visual Studio 2022. C Function #include <stdio.h> // Definition of … Read more

Core Techniques for Implementing OOP in C Language | Example Code

Recommended Advanced Books ↑↑↑ Recommended Reading C Language Dynamic Memory Management: From Beginner to Pro, Understand It All in One Article C Language Pointers: From Beginner to Pro, Understand It All in One Article C Language File Operations: From Beginner to Pro, Understand It All in One Article Top Ten Sorting Algorithms in C Language, … Read more

A Comprehensive Guide to Bit Manipulation in C

A Complete Guide to Bit Manipulation in C 1. Basic Concepts of Bit Manipulation Bit manipulation is a technique that directly operates on the binary bits of integers in memory. The C language provides six bitwise operators: 1. Bitwise AND (&): The result is 1 when both corresponding bits of the operands are 1. 2. … Read more