Pointers in C

Pointer With Arrays

When an array is declared, compiler allocates sufficient amount of memory to contain all the elements of the array. Base address which gives location of the first element is also allocated by the compiler. Suppose we declare an array arr, int arr[5]={ 1, 2, 3, 4, 5 }; Assuming that the base address of arr …

Pointer With Arrays Read More »

Pointer to Structure

Like we have array of integers, array of pointer etc, we can also have array of structure variables. And to make the use of array of structure variables efficient, we use pointers of structure type. We can also have pointer to a single structure variable, but it is mostly used with array of structure variables. …

Pointer to Structure Read More »

Pointer Arithmetic

Pointer arithmetic is very important to understand, if you want to have complete knowledge of pointer. In this topic we will study how the memory addresses change when you increment a pointer. 16 bit Machine ( Turbo C ) In a 16 bit machine, size of all types of pointer, be it int*, float*, char* …

Pointer Arithmetic Read More »

Pointer as Function parameter

Pointer in function parameter list is used to hold address of argument passed during function call. This is also known as call by reference. When a function is called by reference any change made to the reference variable will effect the original variable. Example: Sorting an array using Pointer #include <stdio.h> #include <conio.h> void sorting(int …

Pointer as Function parameter Read More »