* '''QB64 implements memory access using [[_MEM]] and related functions. For that reason, [[DEF SEG]] isn't recommended practice anymore and is supported to maintain compatibility with legacy code.'''
* Used to set the pointer to a memory area of a variable/array or register.
* [[PEEK]] and [[POKE]] require a segment memory address (often just 0) without using VARSEG.
* Important segments using [[PEEK]] and [[POKE]] include &HB800 (text segment) and &HA000 (graphics segment).
* [[BSAVE]] and [[BLOAD]] require a VARSEG reference to the grahic array(0 index) used.
* Always use DEF SEG when the procedure is completed, in order to reset the segment to QBasic's default value.
* [[DEF SEG]], [[VARSEG]], [[VARPTR]], [[PEEK]] and [[POKE]] access QB64's emulated 16 bit conventional memory block. '''It is highly recommended to use QB64's [[_MEM]] memory system to avoid running out of memory.'''
<!--
{{PageExamples}}
''Example:'' In a Qbasic(ONLY) file delete, '''SEG''' forces the parameter to be passed as a far pointer.
{{CodeStart}}
{{Cl|CONST}} file = "trashme.tmp" 'example temporary file name to delete
{{Cl|DEFINT}} A-Z
{{Cl|DIM}} filename {{Cl|AS}} {{Cl|STRING}}
{{Cl|DIM}} result {{Cl|AS}} {{Cl|LONG}}
{{Cl|DIM}} t {{Cl|AS}} {{Cl|STRING}}
{{Cl|DIM}} i {{Cl|AS}} {{Cl|INTEGER}}
{{Cl|CONST}} codelen = 48
{{Cl|DIM}} code {{Cl|AS}} {{Cl|STRING}} * codelen
{{Cl|CLS}}
t = "5589E51E8B560C8EDA8B5E0A8B5702B441CD218B56088EDA8B5E06720B6631C0"
t = t + "6689071F5DCA0800660D0000FFFFEBF0"
{{Cl|FOR...NEXT|FOR}} i = 0 {{Cl|TO}} codelen - 1
{{Cl|MID$}}(code, i + 1, 1) = {{Cl|CHR$}}({{Cl|VAL}}("&h" + {{Cl|MID$}}(t, i + i + 1, 2)))