Conversions    
 
  Constantes 
 
  Kepler's laws  
 
  UnitÚs  
 
  ask us  
 


Coding &
programming


Installing CodeBlocs compiler

C language


C++ language




© The scientific sentence. 1998-2016 
 

Programming with C/C++ Language
Pointers, Arrays and Strings
Arrays in C++





1. Definitions


Arrays are useful because they can be used in many ways to store large amounts of data in a structured way.

Arrays are essentially a way to store many values under the same name. You can make an array out of any data-type including structures and classes.



2. Example of array


Here is an example:



#include 

using namespace std;

int main()
{
int x;
int y;
int array[5][5]; // Declares an array 5x5

for ( x = 0; x <= 4 ; x++ ) {
for ( y = 0; y < 5; y++ )
array[x][y] = x + y; // Fill in the array .
}
cout<<"\t\n Array elements :\n"; 

for ( x = 0; x <= 4; x++ ) {
for ( y = 0; y < 5; y++ )
cout<<"["<<x<<"]["<<y<<"]= " << array[x][y] <<" ";
cout<<"\n";
}
cin.get();
}


Using CodeBlocs, we have:








  

Google
  Web ScientificSentence
 


chimie labs
|
scientific sentence
|
java
|
php
|
green cat
|
contact
|


© Scientificsentence 2009. All rights reserved.