Upcoming SlideShare
×

# Array in c language

9,454

Published on

Published in: Technology
13 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• thank you

Are you sure you want to  Yes  No
• thanku....

Are you sure you want to  Yes  No
Views
Total Views
9,454
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
713
2
Likes
13
Embeds 0
No embeds

No notes for slide

### Array in c language

1. 1. Array in C Language
2. 2. IndexIntroducing Arrays.Declaration of a Array. Variables, Creating Arrays.The Length of Arrays.Initializing Arrays.Multidimensional Arrays.
3. 3. Introducing Arrays Array is a data structure that represents a collection of the same types of data. int num[10];Num reference num [0] num[1] num[2] num [3] An Array of 10 Elements num[4] of type int. num[5] num[6] num[7] num[8] num[9]
4. 4. Declaring Array Variables Data type array name[index]; Example: int list[10]; char num[15]; float hat[20];
5. 5. Creating Arrays Data type array-name[size]; Example: int num[10]; num[0]references the first element in the array. num[9]references the last element in the array.
6. 6. The Length of Arrays Once an array is created, its size is fixed. It cannot be changed. For Example, int arr[10]; You can not insert any number to arr[11] location because it is not initialized.
7. 7. Initializing Arrays Declaring, creating, initializing in one step: int my Array[5] = {1, 2, 3, 4, 5}; int studentAge[4]; studentAge[0] = 14; studentAge[1] = 13; studentAge[2] = 15; studentAge[3] = 16;
8. 8. Multidimensional Arrays int matrix[10] [10];for (i=0; i<10; i++) for (j=0; j<10; j++){ matrix[i] [j] = i * j; }float mat[5] [5];
9. 9. Multidimensional Array Illustration 0 1 2 3 4 0 1 2 3 4 0 1 20 0 0 1 2 31 1 1 4 5 62 2 7 2 7 8 93 3 3 10 11 124 4int matrix[5] [5]; int[][] array ={ matrix[2] [1] = 7 {1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}};
10. 10. Initializing of Multidimensional ArraysTo declare, create and initialize a multidimensional array.For example, int[][] array = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}};This is equivalent to the following statements: array[0][0] = 1; array[0][1] = 2; array[0][2] = 3; array[1][0] = 4; array[1][1] = 5; array[1][2] = 6; array[2][0] = 7; array[2][1] = 8; array[2][2] = 9; array[3][0] = 10; array[3][1] = 11; array[3][2] = 12;
1. #### A particular slide catching your eye?

Clipping is a handy way to collect important slides you want to go back to later.