Understanding Strict-Aliasing Rules
The strict-aliasing rules allow the compiler to assume that your code does not alias between incompatible types. In this way, the compile...
The strict-aliasing rules allow the compiler to assume that your code does not alias between incompatible types. In this way, the compile...
In this dev tip, we talk about a swapping the index and the identifier of an array in C. We see how to swap the index and the array name.
When we define str_1, the compiler creates a character array large enough to hold the string "hello world", which is an immutable string ...
The cleanest and most reliable way to export a global variable is to put an extern declaration inside a header file. This way, when a sou...
A question that often arises when allocating a new block of memory in C is: should I cast the result of malloc or not?
How do you successfully create a file reading loop by checking if you have reached the end of the file? In C the function feof checks for...
The Clockwise-Spiral Rule is a must-have tool that lets C/C++ programmers quickly understand the meaning of variable or function declarat...
The input parameters argc and argv are used to send arguments to a program. The program receives arguments thanks to argv, which is a poi...
An easy way to remember whether it is the pointed value or the address stored in the pointer variable to be constant is to read the decla...
The return type of main must be int, not void. It returns zero to indicate successful termination, otherwise a non-zero value for an abno...
gets is a deprecated function which can cause buffer overflows, use fgets insted.
Let's say we have to process a text file line by line, and we have to make sure that the line we are processing does not end with a newli...
In C, we can't compare strings with == or !==. We have to use functions declared in the string.h header file. Let's see why and how to do it
Sometimes we want to know the size or the number of elements of an array, perhaps because we want to create a for loop that processes eac...
In C and C ++, we must understand the difference between declaration and definition. Studying these languages, we often hear about them. ...