Optional UInt8? gives 2 byte memory size

Viewed 301

UInt8 memory size is 1 byte . but when i make it optional value, it gives 2 byte of size.

   var serail : UInt8? = 255
    print(MemoryLayout.size(ofValue: serail)) // it gives 2 byte size.


        var serail : UInt8 = 255
        print(MemoryLayout.size(ofValue: serail)) // it gives 1 byte size.

how to get exactly 1 byte memory size for Integer value

1 Answers
Related