1

I have the following defined struct:

// A struct that holds all the data for a single plot of land
    struct Land {
        bytes32 geoPoint1;
        bytes32 geoPoint2;
        bytes32 geoPoint3;
        bytes32 geoPoint4;
        address owner;
    }

and I call it using the following

Land memory _land = Land({
                geoPoint1: _geoPoint1,
                geoPoint2: _geoPoint2,
                geoPoint3: _geoPoint3,
                geoPoint4: _geoPoint4
                owner: ?????
            });

            uint256 landID = landRegister.push(_land) - 1;

What do I put into the owner field because I want to leave that as "empty" i.e.

0x0000000000000000000000000000000000000000

When someone purchases this item the field will be completed. If I leave it blank I get errors in Remix stating that there are not the expected number of fields for the struct.

Thanks

3
  • Are you saying you don't want to use 0 for some reason? I would personally just use 0.
    – user19510
    Commented Jan 9, 2018 at 16:03
  • No, I am pretty new to this and wasn't sure how to set a blank address. If it is as simple as using 0 then thats great. Is it just a simple case of checking for 0 when I want to determine if empty? Thanks
    – ORStudios
    Commented Jan 9, 2018 at 16:06
  • Yes, that's it.
    – user19510
    Commented Jan 9, 2018 at 16:09

1 Answer 1

6

This should work:

Land memory _land = Land({
                geoPoint1: 1,
                geoPoint2: 2,
                geoPoint3: 3,
                geoPoint4: 4,
                owner: address(0)
    });

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.