FreePrograms

  CONTACT US   ABOUT US   PRIVACY  DISCLAIMER

C Language Tutorial with Free C Programs

FREE C PROGRAMS 

What is C C vs C++ vs Java Program Structure Data Types in C Basic Rules of C & C++
Functions in C If, Else Conditions Loops in C Switch Case Arrays
Pointers Structures in C Strings in C Command Line Arguments Type Casting
Linked Lists Recursion Binary Trees Inheritance Multiple Inheritance
Templates File I/O Object Oriented Programming Data Structures in C C interview Questions

Arrays: - C Programming Tutorial

Array can be easily defined as a variable that hold multiple elements which has the same data type. C uses arrays as a way of describing a collection of variables with identical properties.

type variable_name[lengthofarray];

Example of Array Declaration:

double arr[100]

Another example :

int myArray[5] = {1, 2, 3, 4, 5}; //declaring and initialize the array in one statement
int number[4];
number[0]=14;
number[1]=13;
number[2]=15;
number[3]=16;

Declaration of a 2D array in C language:

int x[3][2] - matrix 3X2 (3 rows, 2 columns(

Example:

int array[3][3] = {1, 2, 3, 4, 5};
array[0][0] = 1
array[0][1] = 2
array[0][2] = 3
array[1][0] = 4
array[1][1] = 5
array[1][2] = 0
array[2][0] = 0
array[2][1] = 0
array[2][2] = 0

See this program of Matrix Multiplication using the concept of Arrays.

Matrix Multiplication

Multiplying Matrices with Each Other.

© COPYRIGHT 2009 ALL RIGHTS RESERVED FREECPROGRAMS.COM