Quantcast
Viewing all articles
Browse latest Browse all 2703

Please I need this function

Hi friends, I need to write this function with these jobs:

void f( unsigned result[], const unsigned data[], unsigned dataElements,
	const unsigned index[], unsigned indexElements )

f’s job is to set the elements of result to the correct values. No I/O. data has dataElements elements, index has indexElements elements, and result has indexElements elements, because it is parallel to the index array. Each element of index must be in the range [0, dataElements), or f will complain and die. The i’th element of result is copied from whichever element of data has a subscript that is equal to the i’th element of indexElements.
For instance, if data were {1000, 3000, 5000, 3000, 8888} and index were {2, 0, 2, 3, 3, 0}, then result would be set to {5000, 1000, 5000, 3000, 3000, 1000}.


Viewing all articles
Browse latest Browse all 2703

Trending Articles