dappuniversity / election

A Decentralized Ethereum Voting Application Tutorial
563 stars 506 forks source link

TypeError: Data location must be "storage" or "memory" for parameter in function, but none was given. #19

Closed cspartho closed 5 years ago

cspartho commented 5 years ago

function addCandidate (string _name) private { candidatesCount ++; candidates[candidatesCount] = Candidate(candidatesCount, _name, 0); } there is an error on string _name.the compiler says data location must be storage or memory.how to fix it?

malavancs commented 5 years ago

I'm still getting the same error what should i do ?

IndumathiMadhu commented 2 years ago

You need to specify whether your arrays parameters are memory or storage. Change the signature of addCandidate (string _name) to addCandidate (string memory _name).

It worked for me