How do arrays compare with variables and how do they differ? Give a simple example (Programming Logic and Design) Solution Arrays : Array is a homogeneous (same kind of elements) collection of elements in memory in a contagious locations. The first element of array is stored at index =0 and last element is stored at index=size-1. For example, int marks [5] ={10,20,30,40,50}; 10 20 30 40 50 Variable : The variable is a name given to memory location in a computer memory. The element is stored in that memory location can be pointed by the variable name. For example, int id=10; Where id is a name given to the memory location where the value 10 is stored. Comparison of array elements with variables : Since arrays are stored index based, the elements are compared using index location of the element in an array. int min=50; for(int i=0;i<5;i++) //comparison of array element with variable, min if(marks[index]==min) //code follows .