A<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B_Tutorial%2FArray%2Farray</id>
		<title>C++ Tutorial/Array/array - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B_Tutorial%2FArray%2Farray"/>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C%2B%2B_Tutorial/Array/array&amp;action=history"/>
		<updated>2026-04-08T10:28:25Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://cppe.ru/index.php?title=C%2B%2B_Tutorial/Array/array&amp;diff=2906&amp;oldid=prev</id>
		<title> в 14:21, 25 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C%2B%2B_Tutorial/Array/array&amp;diff=2906&amp;oldid=prev"/>
				<updated>2010-05-25T14:21:17Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 14:21, 25 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://cppe.ru/index.php?title=C%2B%2B_Tutorial/Array/array&amp;diff=2907&amp;oldid=prev</id>
		<title>Admin: 1 версия:&amp;#32;Импорт контента...</title>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C%2B%2B_Tutorial/Array/array&amp;diff=2907&amp;oldid=prev"/>
				<updated>2010-05-25T10:31:03Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия: Импорт контента...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==array of strings==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream&amp;gt;  &lt;br /&gt;
  using namespace std;  &lt;br /&gt;
    &lt;br /&gt;
  int main(){  &lt;br /&gt;
     const int DAYS = 7;           &lt;br /&gt;
     const int MAX = 10;           &lt;br /&gt;
     char star[DAYS][MAX] = { &amp;quot;Sunday&amp;quot;, &amp;quot;Monday&amp;quot;, &amp;quot;Tuesday&amp;quot;,  &lt;br /&gt;
                              &amp;quot;Wednesday&amp;quot;, &amp;quot;Thursday&amp;quot;,  &lt;br /&gt;
                              &amp;quot;Friday&amp;quot;, &amp;quot;Saturday&amp;quot;  };  &lt;br /&gt;
     for(int j=0; j&amp;lt;DAYS; j++) &lt;br /&gt;
        cout &amp;lt;&amp;lt; star[j] &amp;lt;&amp;lt; endl;  &lt;br /&gt;
     return 0;  &lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Initializing an array==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using std::cout;&lt;br /&gt;
using std::endl;&lt;br /&gt;
#include &amp;lt;iomanip&amp;gt;&lt;br /&gt;
using std::setw;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   int n[ 10 ];&lt;br /&gt;
   for ( int i = 0; i &amp;lt; 10; i++ )        &lt;br /&gt;
      n[ i ] = 0;&lt;br /&gt;
   for ( int j = 0; j &amp;lt; 10; j++ )        &lt;br /&gt;
      cout &amp;lt;&amp;lt; n[ j ] &amp;lt;&amp;lt; endl;&lt;br /&gt;
   return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;0&lt;br /&gt;
0&lt;br /&gt;
0&lt;br /&gt;
0&lt;br /&gt;
0&lt;br /&gt;
0&lt;br /&gt;
0&lt;br /&gt;
0&lt;br /&gt;
0&lt;br /&gt;
0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Initializing an array in a declaration.==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using std::cout;&lt;br /&gt;
using std::endl;&lt;br /&gt;
#include &amp;lt;iomanip&amp;gt;&lt;br /&gt;
using std::setw;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   int n[ 10 ] = { 2, 7, 4, 8, 5, 4, 9, 7, 6, 3 };&lt;br /&gt;
   &lt;br /&gt;
   for ( int i = 0; i &amp;lt; 10; i++ )&lt;br /&gt;
      cout &amp;lt;&amp;lt; n[ i ] &amp;lt;&amp;lt; endl;&lt;br /&gt;
   return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;2&lt;br /&gt;
7&lt;br /&gt;
4&lt;br /&gt;
8&lt;br /&gt;
5&lt;br /&gt;
4&lt;br /&gt;
9&lt;br /&gt;
7&lt;br /&gt;
6&lt;br /&gt;
3&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Linear search of an array==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using std::cout;&lt;br /&gt;
using std::cin;&lt;br /&gt;
using std::endl;&lt;br /&gt;
int linearSearch( const int [], int, int ); // prototype&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   const int arraySize = 100;&lt;br /&gt;
   int a[ arraySize ];&lt;br /&gt;
   int searchKey = 28;&lt;br /&gt;
   for ( int i = 0; i &amp;lt; arraySize; i++ ) &lt;br /&gt;
      a[ i ] = 2 * i;&lt;br /&gt;
   int element = linearSearch( a, searchKey, arraySize );&lt;br /&gt;
   cout &amp;lt;&amp;lt; element &amp;lt;&amp;lt; endl;&lt;br /&gt;
   return 0;&lt;br /&gt;
}&lt;br /&gt;
int linearSearch( const int array[], int key, int sizeOfArray )&lt;br /&gt;
{&lt;br /&gt;
   for ( int j = 0; j &amp;lt; sizeOfArray; j++ ){&lt;br /&gt;
      if ( array[ j ] == key ){&lt;br /&gt;
         return j;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
   return -1;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;14&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Obtaining the number of array elements==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using std::cout;&lt;br /&gt;
using std::endl;&lt;br /&gt;
int main() {&lt;br /&gt;
  int values[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};&lt;br /&gt;
  cout &amp;lt;&amp;lt; endl&lt;br /&gt;
       &amp;lt;&amp;lt; &amp;quot;There are &amp;quot;&lt;br /&gt;
       &amp;lt;&amp;lt; sizeof values/sizeof values[0]&lt;br /&gt;
       &amp;lt;&amp;lt; &amp;quot; elements in the array.&amp;quot;&lt;br /&gt;
       &amp;lt;&amp;lt; endl;&lt;br /&gt;
  return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;There are 10 elements in the array.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Passing arrays and individual array elements to functions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using std::cout;&lt;br /&gt;
using std::endl;&lt;br /&gt;
#include &amp;lt;iomanip&amp;gt;&lt;br /&gt;
using std::setw;&lt;br /&gt;
void modifyArray( int [], int ); // appears strange&lt;br /&gt;
void modifyElement( int );&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   const int arraySize = 5; // size of array a&lt;br /&gt;
   int a[ arraySize ] = { 0, 1, 2, 3, 4 }; // initialize array a&lt;br /&gt;
   modifyArray( a, arraySize );  &lt;br /&gt;
   for ( int i = 0; i &amp;lt; arraySize; i++ )&lt;br /&gt;
      cout &amp;lt;&amp;lt; setw( 3 ) &amp;lt;&amp;lt; a[ i ];&lt;br /&gt;
   modifyElement( a[ 3 ] );&lt;br /&gt;
   cout &amp;lt;&amp;lt; a[ 3 ] &amp;lt;&amp;lt; endl;&lt;br /&gt;
   return 0;&lt;br /&gt;
}&lt;br /&gt;
void modifyArray( int b[], int sizeOfArray )&lt;br /&gt;
{&lt;br /&gt;
   for ( int i = 0; i &amp;lt; sizeOfArray; i++ )&lt;br /&gt;
      b[ i ] = 200;&lt;br /&gt;
}&lt;br /&gt;
void modifyElement( int e )&lt;br /&gt;
{&lt;br /&gt;
   e = 200 ;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;200200200200200200&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Static arrays are initialized to zero.==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using std::cout;&lt;br /&gt;
using std::endl;&lt;br /&gt;
void staticArrayInit( void );&lt;br /&gt;
void automaticArrayInit( void );&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   staticArrayInit();&lt;br /&gt;
   automaticArrayInit();&lt;br /&gt;
   staticArrayInit();&lt;br /&gt;
   automaticArrayInit();&lt;br /&gt;
   return 0;&lt;br /&gt;
}&lt;br /&gt;
void staticArrayInit( void )&lt;br /&gt;
{&lt;br /&gt;
   static int array1[ 3 ];&lt;br /&gt;
   for ( int i = 0; i &amp;lt; 3; i++ )&lt;br /&gt;
      cout &amp;lt;&amp;lt; &amp;quot;array1[&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot;] = &amp;quot; &amp;lt;&amp;lt; array1[ i ] &amp;lt;&amp;lt; &amp;quot;  &amp;quot;;&lt;br /&gt;
   for ( int j = 0; j &amp;lt; 3; j++ )&lt;br /&gt;
      array1[ j ] = 0;&lt;br /&gt;
}&lt;br /&gt;
void automaticArrayInit( void )&lt;br /&gt;
{&lt;br /&gt;
   int array2[ 3 ] = { 1, 2, 3 };&lt;br /&gt;
   for ( int i = 0; i &amp;lt; 3; i++ )&lt;br /&gt;
      cout &amp;lt;&amp;lt; &amp;quot;array2[&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot;] = &amp;quot; &amp;lt;&amp;lt; array2[ i ] &amp;lt;&amp;lt; &amp;quot;  &amp;quot;;&lt;br /&gt;
   for ( int j = 0; j &amp;lt; 3; j++ )&lt;br /&gt;
      array2[ j ] = 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;array1[0] = 0  array1[1] = 0  array1[2] = 0  array2[0] = 1  array2[1] = 2  array&lt;br /&gt;
2[2] = 3  array1[0] = 0  array1[1] = 0  array1[2] = 0  array2[0] = 1  array2[1]&lt;br /&gt;
= 2  array2[2] = 3&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use subscripting and pointer notations with arrays==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using std::cout;&lt;br /&gt;
using std::endl;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   int b[] = { 10, 20, 30, 40 };&lt;br /&gt;
   int *bPtr = b;&lt;br /&gt;
   for ( int i = 0; i &amp;lt; 4; i++ )&lt;br /&gt;
      cout &amp;lt;&amp;lt; *( b + i ) &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;&lt;br /&gt;
   for ( int j = 0; j &amp;lt; 4; j++ )&lt;br /&gt;
      cout &amp;lt;&amp;lt; bPtr[ j ] &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;&lt;br /&gt;
   for ( int i = 0; i &amp;lt; 4; i++ )&lt;br /&gt;
      cout &amp;lt;&amp;lt; *( bPtr + i ) &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;&lt;br /&gt;
   return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;10&lt;br /&gt;
20&lt;br /&gt;
30&lt;br /&gt;
40&lt;br /&gt;
10&lt;br /&gt;
20&lt;br /&gt;
30&lt;br /&gt;
40&lt;br /&gt;
10&lt;br /&gt;
20&lt;br /&gt;
30&lt;br /&gt;
40&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>