Are memory variables initialized by solidity?

by Ismael   Last Updated August 12, 2019 19:28 PM - source

I've the following struct

struct Vote {
  uint amount;
  uint count;
}

Is it initialized when allocated in memory?

function boofar(uint val) public {
  Vote memory result;
  result.amount += val;
}

When explicitly initialized the gas cost is higher 1481 vs 1417.

Tags : solidity struct


Related Questions



How do you create a new struct?

Updated October 06, 2017 07:28 AM



Stack too deep, try removing local variables

Updated September 18, 2018 06:28 AM