transform(start of array1, end of array1, start of array 2, start of sum array, plus<int>());

Assumes array 2 and the sum array are at least as big as array 1. Need to #include the <algorithm> and <functional> headers for that to work. Still a couple details for you to work out on your own there.

Edit: Probably not the best way... but I like it.

"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens

You shouldn't cram too much into a for loop (or while loop) header. It can get hard to read.

BTW, instead of *(aPtr++) you can use *aPtr++.

dwk

Seek and ye shall find. quaere et invenies.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell

You shouldn't cram too much into a for loop (or while loop) header. It can get hard to read..

Amen to that! It also makes debugging a nightmare, and you will hate yourself for doing that in a very short time when you have forgotton what that is supposed to do. and that semicolon at the end of the line will cause many hours of grief if you ever decide to add code that should be executed on every iteration of the loop, and you don't know why it doesn't work.