Wednesday 22, October 2014
Welcome Guest, Register | Login  
      Home    |    Tutorials    |    Free Ebooks    |    Free Scripts    |    Articles    |    Blog     |    About Us    |    Contact Us

Arrays

An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.

An array is a data structure of multiple elements with the same data type. Array elements are accessed using subscript. The valid range of subscript is 0 to size -1.

Declaration of Array

int arr[10];

Example:
#include 
void main(void)
{
    int a[5];
    int i;
    for(i = 0;i<5;i++)
    {
       a[i]=i;
    }

    for(i = 0;i<5;i++)
    {
        printf("%d value of I is = %d\n",i,a[i]);
    }
}

Output

1 value of I is = 0
2 value of I is = 1
3 value of I is = 2
4 value of I is = 3
5 value of I is = 4

Multidimensional Arrays
A multi-dimensional array of dimension n (i.e., an n-dimensional array or simply n-D array) is a collection of items which is accessed via n subscript expressions. Multidimensional arrays can be described as "arrays of arrays".

Example:

#include 
void main(void){
    int a[3][2];
    int i,j;
    for(i = 0;i<3;i++){
        for(j=0;j<2 ;j++) {
           scanf(“%d”,&a[i][j]);       }
    }

    for(i = 0;i<3;i++){
        for(j=0;j<2;j++) {
           printf("value in array %d\n",a[i][j]);
        }
    }

}


 
     
   
C Language Tutorial
 
  Introduction
Introduction
  First Program
First Program
  Constants and Variables
Constants and Variables
  Loops
Loops
  Control Structure
Control Structure
  Functions
Functions
  Pointers
Pointers
  Arrays
Arrays
  Strings
Strings
  Structures and Unions
Structures and Unions
  File Handling
File Handling
  Graphics
Graphics
 
 
 
Web Designing Tutorials
  HTML Tutorial
HTML Tutorial
  DHTML Tutorial
DHTML  Tutorial
  CSS Tutorial
CSS Tutorial
  XHTML Tutorial
XHTML Tutorial
 
Programming Languages Tutorials
  C Language Tutorial
C Language Tutorial
  C++ Tutorial
C++ Tutorial
  Java Language Tutorial
Java Language Tutorial
  Data Structure Theory Tutorial
Data Structure Theory Tutorial
 
Server Side Scripting Tutorials
  PHP Tutorial
PHP Tutorial
  SQL Tutorial
SQL Tutorial
  ASP Tutorial
ASP Tutorial
 
Client Side Scripting Tutorials
  JavaScript Tutorial
JavaScript Tutorial
  VBScript Tutorial
VBScript Tutorial
 
 
 
POPULAR E-BOOKS
 
Download Building Skills in Object-Oriented Design - Step-by-Step Construction of A Complete Application  Ebook Building Skills in Object-Oriented Design - Step-by-Step Construction of A Complete Application
   
Download The 7 Great Lies of Network Marketing Ebook The 7 Great Lies of Network Marketing
   
Download Dotcomology Ebook Dotcomology
   
Download The Powerful Basics Ebook The Powerful Basics
   
Download Yahoo Answers Traffic Guide Ebook Yahoo Answers Traffic Guide
   
     
Studiesinn.com 2014 All Rights Reserved.
 
Website Designed & Developed by TechXprtz