ptrbinf2.cpp
ptrbinf2.cpp
#include ‹iostream.h›
#include ‹stl.h›
int sum(int x_, int y_) {
return x_ + y_;
}
int input1[4] = {7, 2, 3, 5};
int input2[4] = {1, 5, 5, 8};
int main() {
int output[4];
transform(input1, input1 + 4, input2, output, ptr_fun(sum));
for (int i = 0; i ‹ 4; i++) cout ‹‹ output[i] ‹‹ endl;
return 0;
}