Array in C
Upcoming SlideShare
Loading in...5
×
 

Array in C

on

  • 118 views

This slide contain the introduction to the arrays available in C programming language.

This slide contain the introduction to the arrays available in C programming language.

Statistics

Views

Total Views
118
Slideshare-icon Views on SlideShare
118
Embed Views
0

Actions

Likes
0
Downloads
12
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Array in C Array in C Presentation Transcript

    • INTRODUCTION ONE-DIMENSIONAL ARRAY MULTIDIMENSIONAL ARRAY Array
    • Introduction  It holds multiple values of same type.  Each block of array is stored consecutively in memory. SYNTAX: data-type name[size1][size2]………[sizen]; Example: int a[6];
    • Advantage of Array  Huge amount of data can be stored under single variable name.  Searching of data item is faster.  2 dimension arrays are used to represent the matrices.  It is helpful in implementing other data structure like linked list, queue,stack.
    • One dimensional Array SYNTAX: data-type name[index]; EXAMPLE: int num[10];
    • Initialization  int num[6]={2,4,6,7,8,12};  Individual elements can also be initialize as:  num[0]=2;  num[1]=4;  num[2]=6;  num[3]=7;  num[4]=8;  num[5]=12;
    • Reading Data from User  for loop is used to read data from the user.
    • Class work  WAP to read 10 numbers from the user and display them.  WAP to read 20 numbers from the user and find out the highest number.
    • Multi-dimensional Array  In multi-dimensional we focus on the two dimensional array. SYNTAX: data-type name[row-size][column-size]; EXAMPLE: int a[3][4];
    • Initialization  int odd[3][2]={1,3,5,7,9,11};  Individual element can also be assigned as:  Odd[0][0]=1;  Odd[0][1]=3;  Odd[1][0]=5;  Odd[1][1]=7;  Odd[2][0]=9;  Odd[2][1]=11;
    • Reading Data from the user  Nested for Loop is used.
    • Class Work  WAP to read a 3*3 matrix from the user and display it in the appropriate format.  WAP to read two 3*3 matrices from the user and display their sum.