This is how you can tell that the technology in Star Wars is so much more advanced than our own. When you can re-attach something as complicated as a robotic head assembly to a body with just a few short welds to the exterior surfaces and have the whole thing in perfect working order again, you know there's something miraculous going on. And of course we also had the wrong heads attached to the wrong bodies, yet working together. Presumably there's some sort of universal connector plug/socket thing that automatically aligns itself and establishes communication between the parts. Or perhaps some sort of wireless connection.
The really intriguing part is that the bodies and the heads of various robots seem to have separate power supplies inside them. One wonders why.
GM: The fight continues to rage in the arena.
Padmé: Pete! Help us out.
R2-D2: I remove C-3PO's head from the combat droid body.
C-3PO: I bite him!
R2-D2: I tow the head across the arena.
C-3PO: Hey everyone! R2-D2 thinks combat droids are poopy-heads! Shoot him!
R2-D2: I reattach it to Threepio's body.
C-3PO: Cool! Thanks, Pete!
GM: Great, you're back to your old self now. What do you want to do?
C-3PO: I fight the droids!
GM: 3PO isn't really a combat droid...
C-3PO: Oh yeah.
C-3PO: Bored now. Can I play someone else?