| How can I determine the type and size of a variable?

Previous | TI Variables and the Variable Allocation Table (VAT) | Next

Q: | How I can determine the size of a symbol (i.e. TI-Basic variable) and the TIOS type of the variable?
A: | Assume that you found a VAT symbol entry for a symbol (say symbol named "foo") which may be done for example using SymFindPtr:
    SYM_ENTRY *sym;
    ...
    sym = SymFindPtr (SYMSTR ("foo"), 0);
Then, do the following to find the size and type:
    unsigned short size;
    ESQ type;
    ...
    size = ((MULTI_EXPR*) HeapDeref (sym->handle))->Size + 2;
    type = *(HToESI (sym->handle));
After this, the variables `'size'` and `'type'` will contain exactly what do you want.