2.0 - Pointers and Arrays
2.0 - Pointers and Arrays
Thanks to and Resource from : Sumitabha Das, “Computer Fundamentals and C Programming”, 1st Edition, McGraw Hill, 2018.
Unit I : Contents
1. Pointers- Introduction
2. Pointers and 1D array
3. Passing an array to a function
4. Returning an array from function
5. NULL pointers
6. Array of pointers
7. Pointer-to-pointer
8. Pointers and 2D array
9. Generic pointers
10.Dangling Pointer
11.Using Pointers for string manipulation
12.Two dimensional array of strings
13.Array of pointers to strings.
04/28/2021 2.0 _ Pointers and Arrays 2
Pointers and Arrays
• We are already familiar with arrays, which store multiple values of the
same data type.
• Array elements are stored in contiguous memory locations.
• When an array is declared, compiler allocates required amount of
contiguous memory locations to hold all the elements of the array.
• Memory is allocated by the compiler during compilation time itself.
• Base address of the array is the address of the first element of the array.
• We can create a pointer which can be used to point an array.
• In an one dimensional array, we can use single subscript to access the
array elements.
• Name of the 1-D array or &array[0] points to the address of the first
element of an array.