Operation on array - c program, C/C++ Programming

Operation on array:

void Array::add( Object& toAdd )



    while( ptrAt( lastElementIndex ) != ZERO &&

           lastElementIndex <= upperbound




    if( lastElementIndex > upperbound )

        reallocate( lastElementIndex - lowerbound + 1 );


    setData( lastElementIndex, &toAdd );


    CHECK( itemsInContainer > 0 );



void Array::addAt( Object& toAdd, int atIndex )


    PRECONDITION( atIndex >= lowerbound );

    if( atIndex > upperbound )

        reallocate( atIndex - lowerbound + 1 );


    if( ptrAt( atIndex ) != ZERO )


        delete ptrAt( atIndex );



    setData( atIndex, &toAdd );


Posted Date: 10/18/2012 6:12:11 AM | Location : United States

Related Discussions:- Operation on array - c program, Assignment Help, Ask Question on Operation on array - c program, Get Answer, Expert's Help, Operation on array - c program Discussions

Write discussion on Operation on array - c program
Your posts are moderated
Related Questions
Write a program called Series that will print/display a series of numbers starting with 1 and ending with the last number that is less than 30. The series should include only odd n

overload assignment opertor to assign the data of one object to anthor

How do you declare an integer variable? Explain with an example.

Please use C or C++ to write your programs. Our homework will focus on SUN sparc machines because to exploit x86 stack-overflow is too easy. This is not just a programming assignme

Working Ordered linked list: • Eachinteger in the queue is stored inside of a QueueItem. The QueueItem contains the integer, and a pointer to the next item in the queue. Fo

Explain Register Variable Computers have internal registers, which are used to keep data temporarily, before any operation can be performed. Intermediate results of the calcula

Jewels can only be removed for polishing from either end of the necklace

a padovan string p(n) for a natural number n is defined as p(0)=''x'' p(1)=''y'' p(2)=''z'' p(n)=p(n-2)+p(n-3),n>2

Project Description: Design and prepare software that can navigate a mobile robot using SLAM technique using vision sensor (camera). Skills required are C Programming, Engine