what is array in c programming
In this article today learn what is array in c programming language
and example arry in c programming .subject computer programming is arrayed so this
is one of the important topics in computer
programming so let
us see what is this an array and how many types of arrays out there ok let us
connect so what is an array my array is nothing but it is a group of related
data items so related data items that share a common name that share a common
name that is the
what is array in c programming:
what it means it
is nothing but a group of related data items some related data items will be
there those items share X single name that you call it as array a particular
value in an array first right let me write a particular value in an array.
is identified
using it using its index number or
subscript so what is this so if you want to find any particular element in an
array suppose this is an array these are all groups of related data items
that share a common name suppose name is a swap so this is a strap I array name
so this array name is having a group of related data items so these are all in
each locked
location a data
item will be stored okay suppose a swap 1 0 1 2 3 these are the memory
locations so in each memory location data item will be stored so these all data
items are related to this all data item share a common name that is the swap
it's sharing a common name swap so this all related data item sharing a common
name swap you call it as an array so if you want to a
particular value
in an array is identified if you want to
find out any particular value in an array spam you can use with the help of
index number or subscript index number is nothing but 0 a 1 2 3 these are the
numbers index number allocated to each data item in array so that is about the
error what are the advantages of using arrays let me write the advantages the
first advantage the ability of use a single name to represent a collection of
items the ability it is having the ability o use a single name so for all
related data items we are using only single name single name to represent.
a collection of
items to represent a collection of items and to refer if you want to refer to
an item by specifying the item number that is the index number you can refer to
a particular item by specifying its its name index number or a subscript it
enables the user to develop enables use the user to develop concise and
efficient program so this work this is an advantage of using the array you can
assign a single name to a group of related data items now come let us see how
to declare an eric so in this video i'll explain only the basic concept of the
array.
array example in c programming:
#include <stdio.h>
int main () {
int n[ 10 ]; /*
n is an array of 10 integers */
int i,j;
/* initialize
elements of array n to 0 */
for ( i = 0; i
< 10; i++ ) {
n[ i ] = i +
100; /* set element at location i to i + 100 */
}
/* output each
array element's value */
for (j = 0; j
< 10; j++ ) {
printf("Element[%d] = %d\n", j, n[j] );
}
return 0;
}
No comments:
Post a Comment