Let's say we initialize a state variable as:

uint[10] public fixed_array;

This is a fixed sized array which is currently empty.

What would fixed_array.length return? 0 or 10?

1 Answer 1


This is something that can be quickly and easily tested via remix. If you haven't tried it you should give it a try

pragma solidity 0.4.15;

contract FixedLength {
    uint[10] public fixed_array;

    function getLength()
        return fixed_array.length;

Running and deploying this contract results in getLength() returning 10;

  • Looks like it returns the fixed size. Thanks for the answer! Dec 20, 2017 at 2:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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