4
ARRAYS:- an arrays is a sequence of data items of homogenus. value(same tipe) arrays have two type. One dimenstional array. Two dimensional arrays. an aray that have one subscript /index value to slect an element is called “one dimenstional array”. decleration of ODA… SYNTAX:- DATA TYPE_ARRAY NAME (SIZE); int age {5}; the starting base address of element of the array is known as

what is arrays in c language

Embed Size (px)

Citation preview

Page 1: what is arrays in c language

ARRAYS:-

an arrays is a sequence of data items of homogenus.

value(same tipe)

arrays have two type.

One dimenstional array.

Two dimensional arrays.

an aray that have one subscript /index value to slect an element is called “one dimenstional array”.

decleration of ODA…

SYNTAX:- DATA TYPE_ARRAY NAME (SIZE);

int age {5};

the starting base address of element of the array is known as the base address of that elements or arrays.

INITILLIZATION OF ONE_DIMENSTIONAL ARRAYS:-

Page 2: what is arrays in c language

int age [5 ]= {10,20,30,40,50};

int age [ ]= 10,20,30,40,50};

Accing array element:-

scanf(“%d,&age[2]”);

PROGRAM:- write a program to find the marks of n student using (ODA)\ ARRAY…?

#include <stdio.h>

#include<conio.h>

main ()

{

int marks {10},I,n,sum=0;

printf(“enter #of std”);

scanf(“%d”&n);

for(I=0;i<n;i++);

printf(“enter marks of std %d”,i+1);

scanf(“%d”,marks [i]);

Page 3: what is arrays in c language

sum=marks [i];

}

scanf(“%d”,&age[2]);

printf(“sum=%d”,sum);

return0;

}

TWO DIMENSTIONAL ARRAYS:-

the arrays that have two subscript value to acess an element is known as two dimenstional arrays.

two dimensional array are called matrix in mathematic & table in busness application.

SYNTAX:-

data type_ array name [row][col];

float matrix [3][3];