In the previous post we learn about Difference between compiler and interpreter .In this post we will learn what is array.
Syntax: Data type Array name [size of array];
Output:
What is array:
- Array is used to store more than one values of same data type under a single variable name in continuous memory location.
- In array each value has a unique index number.
- values are start from zero(0).
- first value will be stored at index number zero.
- The address of first index value is also called as based address.
- To access value in array we have to write array name followed by index number in the bracket.
- If we don't write index number then by default first element value will be zero is accessed.
Syntax: Data type Array name [size of array];
program for print array elements:
#include <stdio.h> void main() { int a[5]={2,4,6,8,10},b; for(b=0;b<5;b++) printf("\n%d",b[a]); }
Output:
0 comments:
Post a Comment