TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Thursday, 14 May 2020

Array In C Language | How To Store Value In Array | Array In C Language In Hindi

Array In C Language


C array  is a collection of variable belonging to the same data type. you may store group of data same data type in array.

Array might be belonging to array of the data types.

Array size must be constant value.

Array starting form 0 size.

Always, Contiguous (adjacent) memory location are used to store array elements in memory.

It is a best practice to initialize an array to zero or null while declaring, if we don’t assign any value of array.


image of array in c

Fig: Array in c 





Example:


int  a[10];


How  to declare an array?


datatype  arrayname[size];


Example:


float   mark[5];


Access array element


We caqn access elelment of an array by indices.

We declare an array is mark,then first element is mark[0],and second is mark[1] and so on.



image of declaration in c
 Fig:Declaration in c



How to initialize an array?


It is possible to initialize an array during declaration


Example:


int  mark[5]={10,11,12,13,14};

Now we can initialize like this also

int  mark[ ]={10,11,12,13,14};

Here we specified the size so compiler know its size is 5 as  we are initializing it with 5 elements.



image of initialize array in c
Fig: Initialize  array in c 

No comments:

Post a Comment