I am doing the cryptozombies.io course on Solidity.

In Chapter 7 of Making the Zombie Factory, it introduces function declarations. The instructions on this chapter are:

Create a public function named createZombie. It should take two parameters: _name (a string), and _dna (a uint). Don't forget to pass the first argument by value by using the memory keyword

My question is why is the _name parameter required to be declared with keyword memory (and similarly, why is the _dna parameter NOT required to be declared with keyword memory)?

In general, when does one declare a parameter using keyword memory and without it? I did Google about the memory keyword but I did not understand when it should be used and when it shouldn't.

1 Answer 1


Unsigned Integer or integers do not require memory specification when declared as arguments. Strings, arrays and structs require memory specification.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.