Maybe this question it seems to be stupid but is it possible to change elements of fixed-size array like bytes32. For example:
bytes32 _b32 = sha3(1);
_b32[0] = 100; // => Error
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityIt's possible to mutate elements of a fixed-sized array, but not a fixed-sized byte array (like bytes32
).
So this is valid:
byte[32] myBytes;
myBytes[3] = 0x5;
but this is not valid:
bytes32 myBytes;
myBytes[3] = 0x5; // TypeError: Expression has to be an lvalue.