0% found this document useful (0 votes)
5 views1 page

Array 1d Answer

A one-dimensional array is a data structure that holds multiple values of the same type. Declaration involves specifying the data type and size, such as 'int arr[5];'. Initialization can occur at the time of declaration or afterward by assigning values to individual elements.

Uploaded by

tanishbhogale
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Array 1d Answer

A one-dimensional array is a data structure that holds multiple values of the same type. Declaration involves specifying the data type and size, such as 'int arr[5];'. Initialization can occur at the time of declaration or afterward by assigning values to individual elements.

Uploaded by

tanishbhogale
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Explain Declaration and Initialization of One

Dimensional Array (4 Marks)

A one-dimensional array is used to store multiple values of the same data type in a single variable.

1. Declaration of Array:
Declaration means creating an array by specifying its data type and size.
Syntax:
data_type array_name[size];
Example:
int arr[5];

2. Initialization of Array:
Initialization means assigning values to the array.

(i) At declaration:
int arr[5] = {10, 20, 30, 40, 50};

(ii) After declaration:


arr[0] = 10;
arr[1] = 20;
arr[2] = 30;
arr[3] = 40;
arr[4] = 50;

You might also like