QBasic/Working With Strings
What are strings and what are they used for?[edit | edit source]
In QBASIC, a string is a contiguous sequence of ASCII encoded characters in memory. The characters are stored in memory as an 8 bit byte. Strings in QBASIC are mutable meaning they can be changed in place without allocating new memory. By now if you have read the prior chapters, you should know that strings are typically used to represent numbers, letters, and other symbols and are used to display information on screen, and getting user input. In the Files chapter you will find that strings can be saved into and read from files as well. If you get creative you can use strings for other purposes. One example is adding large numbers hundreds of digits long. In QBASIC you cannot do that with its built in numeric data types. You could however store the digits in string form and write your own function to add a couple of strings containing digits together thus overcoming some of the initial QBASIC constraints.