top of page
Blog
Damiano Pe
Jan 26, 2022
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 compiler
226 views
Damiano Pe
Jan 12, 2022
A Trick You May Not Know And You Shouldn't Even Use
In this dev tip, we talk about a trick that most likely you don't know and which is now more than anything else a legacy of the...
121 views
mattiaducci
Dec 21, 2021
C-Christmas tree
In this article we will create a sparkling Christmas tree in C using ANSI escape sequences and a smart use of pointers
404 views
Damiano Pe
Dec 9, 2021
The Difference Between char str* And char str[]
When we define str_1, the compiler creates a character array large enough to hold the string "hello world", which is an immutable string...
98 views
Damiano Pe
Nov 25, 2021
Effectively Use extern To Share Global Variables
The cleanest and most reliable way to export a global variable is to put an extern declaration inside a header file. This way, when...
44 views
Damiano Pe
Nov 10, 2021
Don't Use feof() To Control A File Read Loop
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...
48 views
Damiano Pe
Nov 3, 2021
Understand All Declarations With The Clockwise-Spiral Rule
The Clockwise-Spiral Rule is a must-have tool that lets C/C++ programmers quickly understand the meaning of variable or function declaration
119 views
Damiano Pe
Nov 2, 2021
The Meaning Of argc And argv In main()
The input parameters argc and argv are used to send arguments to a program. The program receives arguments thanks to argv, which is a...
57 views
Damiano Pe
Nov 2, 2021
The Difference Between const int * And int *const
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...
100 views
Damiano Pe
Oct 23, 2021
The Correct Return Type Of main()
The return type of main must be int, not void. It returns zero to indicate successful termination, otherwise a non-zero value for an...
25 views
Damiano Pe
Oct 23, 2021
Never Use gets To Read A Line
gets is a deprecated function which can cause buffer overflows, use fgets insted.
19 views
Damiano Pe
Oct 23, 2021
How To Remove Trailing Newline Character From fgets Input
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 newline
27 views
Damiano Pe
Oct 23, 2021
How To Properly Compare Strings
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
26 views
Damiano Pe
Oct 23, 2021
How To Get The Size Of An Array
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...
30 views
Damiano Pe
Oct 23, 2021
Declaration VS Definition: What's The Difference
In C and C ++, we must understand the difference between declaration and definition. Studying these languages, we often hear about them...
41 views
bottom of page