What is an array in C?
a) A collection of elements of the same data type
b) A single variable that stores multiple data types
c) A function that returns multiple values
d) A loop that iterates a fixed number of times
Answer:
a) A collection of elements of the same data type
Explanation:
An array in C is a collection of elements of the same data type stored in contiguous memory locations. Arrays allow for the efficient storage and manipulation of multiple related data items under a single variable name. Elements in an array can be accessed using their index, with the first element having an index of 0. Arrays are commonly used in C for tasks that involve storing and processing collections of data, such as lists of numbers or characters.
Understanding arrays is essential for handling multiple related data items in a structured and efficient manner in C programs.