#include <iostream>

// using namespace std; // avoid this, especially at global scope

// use whitespace to make it more readable
void print_array( const int arg[], int length, char seperator )
{
    int i = 0 ;
    for(  ; i < length-1 ; ++i )
        std::cout << arg[i] << seperator ;
    if( length > 0 ) std::cout << arg[i] ; // print the last element
}

// seperate words in identifiers with an _  (or change of case)
int add_array( const int arg[], int length ) // make it const-correct
{
    int sum = 0 ; // give this a more intuitive name
    for( int i=0; i<length; ++i ) // get into the habit of using prefix increment/decrement
        sum = sum + arg[i] ;

    // the function should just return the sum and leave the decision about what the
    //  sum is to be used for to the caller.

    return sum ;
}

int main()
{
    const int first_array[] = {5,5,5,5}; // const-correct
    const int second_array[] = {6,16,26,36,46,56}; // const-correct

    // why should we hard code magic numbers
    // when the compiler can calculate it for us?
    const int sz_first = sizeof(first_array) / sizeof( first_array[0] ) ;
    const int sz_second = sizeof(second_array) / sizeof( second_array[0] ) ;

    print_array( first_array, sz_first, '+' ) ;
    std::cout << " == " << add_array( first_array, sz_first ) << '\n' ;

    print_array( second_array, sz_second, '+' ) ;
    std::cout << " == " << add_array( second_array, sz_second ) << '\n' ;

    // there is an implicit return 0 ; here
}
