C/C++ Array and Pointer Traps

In C/C++, arrays and pointers are fundamental and powerful tools, but they are also often sources of programming errors. Because they can be interchangeable in certain situations (such as when passing function parameters), developers can easily confuse their essence, leading to various “traps”. Here are some common traps of arrays and pointers, along with brief … Read more

Understanding C Language: Using Pointers as Function Parameters

Understanding C Language: Using Pointers as Function Parameters

This is the 22nd article in the C language introductory series. Most of the programs we have written so far only contain a main function. However, in larger programs, there are usually multiple functions, and the main function contains statements that call other functions. 1 Structure of C Programs C programs are designed using a … Read more

Why Use References When C++ Already Has Pointers?

Why Use References When C++ Already Has Pointers?

In the daily development of C++, many developers are puzzled: since pointers can fulfill all indirect access needs, why did the C++ standards committee specifically introduce references? Some say references are “syntactic sugar for pointers,” but if it’s merely a syntactic simplification, why has it become an indispensable core feature of C++? Today, we will … Read more

Essential Knowledge Points for C Language Beginners: Understanding the Relationship Between Pointers and Arrays

Essential Knowledge Points for C Language Beginners: Understanding the Relationship Between Pointers and Arrays

“From today on, study hard and make progress every day” Repetition is the best method for memory; spend one minute every day to remember the basics of C language. “C Language Beginner’s Essential Knowledge Points Note Series of 100 Articles”“ The following notes finally enter the practical series, which is also the most important and … Read more

Daily C Language Knowledge Point: The const Type Qualifier

Daily C Language Knowledge Point: The const Type Qualifier

A. Using const when declaring variables const int nochange; /* This restricts the value of the variable nochange from being modified */ const int nochange = 10; /* This statement is correct */ const int nochange; nochange = 10; /* The compiler will report an error because it cannot be assigned a value after declaration … Read more

Exploring C Language Pointers (Part 6)

Exploring C Language Pointers (Part 6)

In the previous articles, we mainly covered pointer algorithms, pointer arrays and array pointers, function pointers, void generic pointers, and linked lists. This article serves as a supplement, adding some common usage patterns and precautions for C pointers. 1. Pointer Swapping: An Efficient Way to Exchange Values By directly manipulating memory addresses through pointers, we … Read more

Essential Knowledge Points for C Language Beginners: A Comprehensive Summary of Pointers

Essential Knowledge Points for C Language Beginners: A Comprehensive Summary of Pointers

“From today onwards, study hard and make progress every day” Repetition is the best method for memory; spend one minute each day to remember the basics of C language. “C Language Beginner’s Essential Knowledge Points Note Series 100”“ The following notes finally enter the practical series, which is also the most important and difficult part … Read more

Flexible Arrays vs Pointers in C Language

Flexible Arrays vs Pointers in C Language

Click the blue “One Bite Linux” in the upper left corner, and select “Set as Favorite“ Get the latest technical articles first ☞【Technical Content】Learning Path for Embedded Driver Engineers ☞【Technical Content】Linux Embedded Knowledge Points – Mind Map – Free Access ☞【Employment】A Comprehensive Project Based on Linux IoT for Your Resume ☞【Employment】Resume Template Introducing a knowledge … Read more

Comparing Pointers in Go and C/C++

Comparing Pointers in Go and C/C++

This article compares the use of pointers in Go and C/C++, understanding how Go’s pointer design addresses the safety issues inherent in C/C++ while retaining their advantages. Original text:Pointers Made Painless: How Go Solves C/C++’s Biggest Headache[1] Few things in the world possess both strength and fragility in the same characteristic. In the realm of … Read more

Understanding C++ References from an Assembly Perspective: The Pointer Nature Behind Syntax Sugar

Understanding C++ References from an Assembly Perspective: The Pointer Nature Behind Syntax Sugar

1. Introduction When learning C++, we often hear the phrase: “A reference is an alias for a variable.” This statement is quite intuitive at the beginner level, but if we stop at this understanding, it becomes difficult to grasp how it operates at a lower level. Under the compiler’s handling, references may behave similarly to … Read more