POINTERS AND ARRAYS: What is an array? An array is a data structure consisting of elements of similar data type. The elements of an array are stored in consecutive memory locations. How to declare an array? Below is the template for array declaration. datatype name[number of elements]; int num[10]; Here, num is array of 10 integers. How to access array elements? Array indices are used to access array elements. And the array index starts from zero. int arr[5] = {1, 2, 3, 4, 5}; arr[0] gives us the element at the 0th index in the array arr . Let us try to read the array elements one by one. arr[0] is 1 arr[1] is 2 arr[2] is 3 arr[3] is 4 arr[4] is 5 How to access array elements using pointers? To access array elements, assign the base address of array to the pointer. int *ptr; int arr[5] = {10, 20, 30, 40, 50}; p...
The Only Shot to You need to kickstart your programming in any language