# Arrays

Views:

Category: Education

## Presentation Description

No description available.

By: Ratnam (101 month(s) ago)

thank u sir giving this.

## Presentation Transcript

### Arrays :

SSIT HYDERABAD 1 Arrays C Programming

### Definition :

SSIT HYDERABAD 2 Definition Array is nothing but a group of similar type of variables. Array is a collection of homogeneous or similar data type elements. An array is the same variable name with different values. Why Array? Write a program to read and display 5 Numbers. #include<stdio.h> #include<conio.h> int main(void){ int a,b,c,d,e; printf(“Enter 5 Numbers”); scanf(“%d%d%d%d%d”,&a,&b,&c,&d,&e); printf(%d %d %d %d %d”,a,b,c,d,e); return 0; }

### Array Cont… :

SSIT HYDERABAD 3 Array Cont… We can construct array of any type moreover we can construct one dimensional as well as multi dimensional array. Dimension also specifies by index. Each array starts with the index number as 0. And 0th index is called the base index of the array. To construct one dimensional array system is expective three specification. Group Name No of Variables in the group Type of variables in the group We can specify these things by using array variable declaration statement Syntax Type Array_Variable[Size];

### Array Cont… :

SSIT HYDERABAD 4 Array Cont… Ex : int nos[15]; Here group name is : nos No of Variable : 5 Type of Variable : int For 5 variables memory location will be allocated in continuous manner variables in the group are called elements. Each element is identifying with unique index. To name the element of the array { ArrayName[Index] Name of the First Element Nos[0]=10; Nos[4]=50

### Exercise :

SSIT HYDERABAD 5 Exercise Problem Definition –1 Write a program to display 5 given number s in reverse order. Problem Definition –2 Write a program to display sum of five given numbers. Problem Definition –3 Write a program to display number of days in a given months. Problem Definition –4 Write a program to display absolute value of given number.