Varseg and Varptr are the special way qbasic has to point to a memory position.
Dos is able to access to 1Meg of memory, 1Meg in binary is a number of 20 bits. As the processor Dos was designed for was 16 bits (8086) the memory addresses are handled as two 16 bit words, the segment and the address, as in &ha000:&h0001
The Qbasic keywords using addresses to access directly to memory by are PEEK, POKE, BLOAD and BSAVE.
To access a memory position you first
DEF SEG =segment
and then you perform the needed operations
p.e
poke Offset,n 'sets to n the byte at segment

ffset
VARSEG and VARPTR are functions allowing your program to know where in memory are your variables, so you can peek and poke them. VARSEG returns the segment and VARPTR returns offset.
Code:
]
a%=2
DEF SEG=varseg(a%)
poke varptr(a%),4
print a% 'should print 4
for the string variables VARPTR must be substituted by SADD
Code:
a$=" "
DEF SEG=VARSEG(A$)
POKE SADD(A$),65
PRINT A$ 'should print 'A'
Be careful with direct peeks and pokes, none of the QB's safety nets work there. You can corrupt the data, the program or cause a General Protection Fault in Windows, by poking to the wrong place, so ALWAYS save your program before running.
the segment of the graphics screen is &HA000 (no need of a VARSEG to know it, it's fixed) so
Code:
screen 13
def seg =&ha000
poke 10,15 'should plot a white dot at column 10
Don't forget QB drawing primitives clip automatically everything you draw to the limits of the screen,and with direct pokes you must do yourself the clipping. If you poke outside the screen limits your program can be corrupted or cause a windows fault. Antoni