I understand what add() does. It used used in the assembly to perform additions. My question is why are we adding 32 here? What is the purpose of doing so?
The full code is here
To better understand it is better to include part of the function
function stringToBytes32(string memory source) public pure returns (bytes32 result) {
// ..
assembly {
result := mload(add(source, 32))
}
}
source is a memory string so the first 32 bytes contains the length and data follows. Then add(source, 32) skips the size portion of the string, and points to the data.