Yep, Macs and PCs are really compatible. Hard drives, flash drives, jump drives, memory... it all works the same way.
Note that, when you mention "memory", if you're talking about
RAM, remember that it comes in many shapes and sizes. While it will work in both Macs and PCs, you have to make sure the shape/size of the RAM stick matches the computer you're putting it in.