#include <iostream>
using std::cout;
using std::endl;
void staticArrayInit( void );
void automaticArrayInit( void );
int main()
{
staticArrayInit();
automaticArrayInit();
staticArrayInit();
automaticArrayInit();
return 0;
}
void staticArrayInit( void )
{
static int array1[ 3 ];
for ( int i = 0; i < 3; i++ )
cout << "array1[" << i << "] = " << array1[ i ] << " ";
for ( int j = 0; j < 3; j++ )
array1[ j ] = 0;
}
void automaticArrayInit( void )
{
int array2[ 3 ] = { 1, 2, 3 };
for ( int i = 0; i < 3; i++ )
cout << "array2[" << i << "] = " << array2[ i ] << " ";
for ( int j = 0; j < 3; j++ )
array2[ j ] = 0;
}
|