sizeof.bmx 359 B

12345678910111213141516171819202122
  1. Rem
  2. SizeOf returns the number of bytes of system memory used to store the variable.
  3. End Rem
  4. Type MyType
  5. Field a,b,c
  6. End Type
  7. Local t:MyType
  8. print sizeof t 'prints 12
  9. Local f!
  10. print sizeof f 'prints 8
  11. Local i
  12. print sizeof i 'prints 4
  13. Local b:Byte
  14. print sizeof b 'prints 1
  15. a$="Hello World"
  16. print sizeof a 'prints 22 (unicode characters take 2 bytes each)