Are memory variables initialized by solidity?

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

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


Updated August 31, 2017 03:28 AM

Updated October 06, 2017 07:28 AM

Updated October 10, 2017 22:28 PM

Updated June 25, 2018 12:28 PM

Updated September 18, 2018 06:28 AM