Unit Ii-Arrays
Unit Ii-Arrays
ARRAYS
• An array in C is a fixed-size collection of similar
data items stored in contiguous memory
locations.
• It can be used to store the collection of
primitive data types such as int, char, float,
etc., and also derived and user-defined data
types such as pointers, structures, etc
Array Declaration
• int main()
• {
• int main()
• {
• // array declaration and initialization
• int arr[5] = { 10, 20, 30, 40, 50 };
• return 0;
• }
output
• Elements in Array: 10 20 100 40 50