2. Arrays in c programming
Typing Speed:
muhammed ajmal
ajmalmp777@gmail.com
ajmalmp
ajmalmp
in.linkedin.com/in/profilena
me
8547712876
3. Arrays in c programming
• An array is a collection of same type of
elements which are sheltered under a
common name.
4. Different types of arrays
• 1- dimensional array
• 2-dimensional array
• Multi-dimensional array
5. One-dimensional arrays
• One dimensional array have only one
subscript under a common name.
• syntax
• Data_type array_name[array_size];
• Example
• int age[5]={2,4,34,3,4};
7. Two-dimensional arrays
• Two-dimensional array are those type of
array, which has finite number of rows and
finite number of columns.
• Data_type Array_name [row size][column
size];
9. Multi-dimensional arrays
• An array have multiple subscript under a
common name.
• Syntax
• type name[size1][size2]...[sizeN];
• Example
• float a[2][6][7][4]….[n];
10. • Subscripted Variable Rules
• Subscripted variables can
be double, integer, or character.
• The maximum number of subscripts is dictated by the
compiler vendor. Twelve is common.
• Arithmetic expressions may be used for subscripts.
• Subscripts must be integer valued.
• A statement must be included in your program which
sets aside storage space (dimensions) for your arrays.
11. •
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Example programm
#include<stdio.h>
int main()
{
int a[4][4][4], i , j,k;
for (i = 0; i < 4; i++)
{
for ( j = 0; j < 4; j++)
{
for ( k = 0; k < 4; k++)
{
a[i][j][k] = 0;
scanf("a[%d][%d][%d] ", i, j,k, a[i][j][k]);
}
}
}
for (i = 0; i < 4; i++)
{
for ( j = 0; j < 4; j++)
{
for ( k = 0; k < 4; k++)
{
a[i][j][k] = 0;
printf("a[%d][%d][%d] = %d n", i, j,k, a[i][j][k]);
}
}
}
•
}
12. If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
13. Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550