Skip to main content

Posts

Showing posts from September 29, 2019

DATA_STRUCTURE LEARNING SHEET

                 Arrays  An array is a collection of items stored at contiguous memory locations. The idea is to declare multiple items of the same type together. Array declaration: In C, we can declare an array by specifying its and size or by initializing it or by both. int arr[10];  // Array declaration by specifying size int arr[] = {10, 20, 30, 40};      // Array declaration by initializing elements int arr[6] = {10, 20, 30, 40}   // Array declaration by specifying size and initializing elements Formulas:                   Length of Array = UB - LB + 1  UB = Upper bound LB = Lower bound Given the address of the first element, the address of any other element is calculated using the formula:-    Loc (arr [k]) = base (arr) + w * k    w = number of bytes per s...