Stringize (#) and token pasting (##) operator in C language

C programming supports two special preprocessor directive for string operations. Stringize (#) and token pasting (##) are C preprocessor string manipulation operators.

In previous article we learned about basic and conditional preprocessor directives in C language. In this article we will move further and learn string manipulation preprocessor operators.

Read more

C preprocessor directives – #include, #define, #undef and conditional directives

A C preprocessor is a statement substitution (text substitution) in C programming language. It instructs the C compiler to do some specific (required) pre-processing before the compilation process.

When we compile a C program, C preprocessor processes the statements which are associated with it and expand them to make the code for further compilation.

Read more

Five common pointer mistakes in C programming

Pointer is the most important and powerful tool in C language. Pointer resolves many complicated problems easily but if you don’t have the sufficient knowledge of pointers, you will face problems like segmentation fault etc.

In this article, I will describe five common pointer mistakes in C programming which generally occurs.

Read more

Unions in C programming language, need and use

Unions in C are user defined data type similar to structures. Union allows to define multiple members of different type at single location. In this article I will explain what is union, need of union, how to declare, define and access unions in C programming language.

We use unions to define a new data type, similar to structures in C. Its definition, use and access are almost similar to structures. If I say its similar to structure, then you may think why in the world do we need it then. Hence, let us first explore the real world need of a union type.

Read more

Dynamic memory allocation in C programming

Dynamic memory allocation refers to the process of manual memory management (allocation and deallocation). Dynamic memory allocation in C is performed via a group of built-in functions malloc(), calloc(), realloc() and free(). Some text also refer Dynamic memory allocation as Runtime memory allocation.

Read more

10 cool bitwise operator hacks and tricks every programmer must know

Bitwise operators are used to manipulate data at its lowest level (bit level). Data in memory (RAM) is organized as a sequence of bytes. Each byte is a group of eight consecutive bits. We use bitwise operators whenever we need to manipulate bits directly. In this post I will show you some cool bitwise operator hacks and tricks. These hacks will boost your programming skill.

Read more

How to pass and return array from function in C?

Functions makes our program modular and maintainable. Big applications can have hundreds of functions.

Array is a data structure to store homogeneous collection of data. Arrays are equally important as functions. In programming we often use arrays and functions together.

Here in this post I will explain how to pass and return array from function in C programming.

Read more