#define to implement constants

The preprocessor allows us to customize the language. For example to replace { and } of C language to begin and end as block-statement delimiters…

Preprocessor in C Language

Theoretically, the “preprocessor” is a translation phase that is applied to the source code before the compiler gets its hands on it. The C Preprocessor…

Pointers and Strings

A string in C is an array of characters ending in the null character (written as ‘\0′), which specifies where the string terminates in memory….

Array of Pointers

The way there can be an array of integers or an array of float numbers, similarly, there can be an array of pointers too. Since…

Pointers and Multidimensional Arrays

C allows multidimensional arrays, lays them out in memory as contiguous locations, and does more behind the scenes address arithmetic. Consider a 2-dimensional array. int…

Arrays and pointers

Pointers and arrays are so closely related. An array declaration such as int arr[ 5 ] will lead the compiler to pick an address to…

Function returning a pointer

A function can also return a pointer to the calling program, the way it returns an int, a float or any other data type. To…

Passing pointers to functions

Arguments can generally be passed to functions in one of the two following ways: 1. Pass by value method 2. Pass by reference method In…

Pointer Arithmetic

Pointer variables can also be used in arithmetic expressions. The following operations can be carried out on pointers: 1.Pointers can be incremented or decremented to…

Null Pointer Assignment

It does make sense to assign an integer value to a pointer variable. An exception is an assignment of 0, which is sometimes used to…

Pointer to a Pointer

The concept of the pointer can be extended further. As we have seen earlier, a pointer variable can be assigned the address of an ordinary…

Pointer Characteristics

Computer’s memory is made up of a sequential collection of storage cells called bytes. Each byte has a number called an address associated with it….

Pointers in C

If you want to be proficient in the writing of code in the C programming language, you must have a thorough working knowledge of how…

Accessing the members of an union

Individual union members can be used in the same way as the structure members, by using the member operator or dot operator (.). However, there…

Unions

Structures are a way of grouping homogeneous data together. But it often happens that at any time we require only one of the member’s data….

Structures and Arrays

Thus far we have studied as to how the data of heterogeneous nature can be grouped together and be referenced as a single unit of…

Structures as Function Arguments

C is a structured programming language and the basic concept in it is the modularity of the programs. This concept is supported by the functions…