Skip to main content
Share Your Experience: Take the 2024 Developer Survey
4 votes

In solidity, how to copy a string or pass it by value?

Strings and arrays in solidity are never passed by value. The type string memory means that the variable contains a memory pointer, so when you assign a = b you are only copying the pointer to the ...
Jesbus's user avatar
  • 10.5k
2 votes

Local storage variable

Value assignment to a variable can be done by either giving a reference or creating an independent copy. If it's a reference when the original one which is assigned to the variable get changed value ...
Achala Dissanayake's user avatar
1 vote

Creating a local memory copy of a global uint256

The error in the code is that value is being assigned as a reference to myInt, resulting in value always reflecting the current state of myInt. To fix this, directly assign myInt to value to create a ...
DevCrypto's user avatar
  • 422
1 vote

Understanding why this blob of assembly code adds 0x20 and 0x1f

Info: 0x40 is a special address: Solidity manages memory in the following way. There is a “free memory pointer” at position 0x40 in ...
Stormsson's user avatar
  • 379
1 vote

Local storage variable

Apart from the accepted answer, I think it's needed to identify what data locations are as well. Documentation provides a good description on available data locations. Data location Every reference ...
Refiner's user avatar
  • 157

Only top scored, non community-wiki answers of a minimum length are eligible