Interpreting Complex C Declarations

Once you start mixing pointers to functions in your C declarations you’ll notice that things can get complex. For example, what does the following declaration represent: float * (* (*ptr)(int))(double **,char c) What about this one: unsigned **( * (*ptr) [5] ) (char const *,int *) One tool you can use to help you with […]

The Art of Swapping Variables

Swapping variables is probably one of the most common operations inside computer programs. But did you know that there are many ways to perform a swamp? Below I’ll talk about some of them. Using an Extra Variable The easiest way is to use an extra temporary variable (usually called “temp”) where you store the value […]