Wednesday 26, April 2017
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 An Introduction to GCC  Ebook An Introduction to GCC
   
Download Make Money With Resale Rights Products Ebook Make Money With Resale Rights Products
   
Download PHP 5 Power Programming  Ebook PHP 5 Power Programming
   
Download Hidden Internet Revenue Resources Ebook Hidden Internet Revenue Resources
   
Download Eloquent JavaScript - An Opinionated Guide to Programming  Ebook Eloquent JavaScript - An Opinionated Guide to Programming
   
     
Studiesinn.com 2017 All Rights Reserved.
 
Website Designed & Developed by TechXprtz