Array, Structure & Function – Notes
1. Array – Definition
An array is a collection of elements of the same data type stored in contiguous memory locations
and accessed using a single variable name.
Example:
int arr[5] = {1, 2, 3, 4, 5};
2. Structure – Definition
A structure is a user-defined data type that allows grouping of variables of different data types
under a single name.
Example:
struct Student { int id; char name[20]; float marks; };
3. Function – Definition
A function is a block of code that performs a specific task and can be called whenever required to
avoid repetition.
Example:
int add(int a, int b) { return a + b; }
Differentiation Questions
1 Differentiate between Array and Structure.
2 Differentiate between Structure and Function.
3 Differentiate between Array and Function.
4 Differentiate between Single-dimensional array and Multi-dimensional array.
5 Differentiate between Built-in functions and User-defined functions.