Computer Science, asked by samadhangaikwad630, 4 months ago

How do you initialize an array in C?
intarr(3) = (1,2,3);
intarr[3] = {1,2,3};
intarr[3] = (1,2,3);
intarr(3) = {1,2,3};​

Answers

Answered by Haruhi22
0

Answer:

int arr[3]={1,2,3};

in c

Answered by malini5426
0

Answer:

An array in C here is initialised in the following way: int arr[3]={1,2,3};

Explanation:

An Array is the simplest form of data structure which stores similar data elements(types) in a well structured and ordered fashion.

The standard syntax for initialising an array in C

Syntax: data_type variable_name[size]={elements}

here, data_type refers to the kind of data you're storing. For instance numbers are of int data type, while alphabets are of character(char) data type. The variable_name refers to name of the location where the elements are you data is stored.

Note: When data type is specified, you cannot insert elements that do not belong to the data type.

Ex: int arr[3]={1,2,3}  //Correct

     int arr[3]={a,b,c} //Wrong, throws an error of incorrect data_type.

Learn more about arrays here:

https://brainly.in/question/6098701

Learn more about data structures here:

https://brainly.in/textbook-solutions/q-data-structures-common-data-structures-1

Similar questions