Write a function with two int* arguments begin and end, which give give the boundaries of a memory block of ints, and int argument x, which adds x to every element in the memory block.
The following sample task may help:
Write a function with two int* arguments begin and end, which give the address of the first element in a memory block of integers, and the address of the memory space immediately after the last element in the block, correspondingly, which returns the sum of the elements in the block.
int sum(int* begin, int* end)
{
int* p;
int s;
for (s=0, p=begin; p!=end; ++p)
s+= *p;
return s;
2006-11-29
23:04:07
·
1 answers
·
asked by
christinaf559
1
in
Computers & Internet
➔ Programming & Design