Back to HomePage Credits Puke SumFuka Saqquara

 Variables Part 1 OK, now you know what's going on, its time to learn about variables. You've learned how to talk to the user, now its time to learn how to listen, but first you must know about variables. Variables are such a simple component of any programming language, the concept should be easy to grasp, even without a complete explanation. Consider the following statement: X = 10; This will put the value 10 (in binary form) and insert it into the space in the memory reserved for variable 'X'. Then, further in the program, when X is mentioned, the computer will think of the value 10, instead of the letter 'X'. Of course, the value of X can easily be changed further down in the code. Consider: X = 20; From then on, 'X' will represent 20, and not 10, for the rest of the program. One thing to note is when creating variables (which you will do later) is the name you give it. The name of the actual variable must consist only of 'a' to 'z', 'A' to 'Z', the underscore or numbers. Names are case-sensitive, so 'a' is completely different from 'A'. Consider the following statement: Amount-Paid = 750; This would not work, because the compiler would try to do the following mathematical calculation: 'Amount - Paid' which of course is total nonsense. The variable name 'AmountPaid' or 'amount_paid' would work fine. OK, before assigning a value to a variable, it must be created, and its data-type defined. The data-type of a variable decides what sort of data the variable can store. There are four important ones, characters, integers, long integers, and floating point decimal numbers. In C, there names are char, int, long, and float respectively. A character is a single letter (not a string) such as 'B' or '?'. An integer is a whole number like '2', of '175', but not '2.1'. A long integer is a long whole number, such as '100,000,000,000'. And finally, a float is a number with a decimal point, like '2.1' or '3.333333'. Tutorial by Puke ``` ```

 This site, and all content and graphics displayed on it, are ©opyrighted to the Quake DeveLS team. All rights received. Got a suggestion? Comment? Question? Hate mail? Send it to us! Oh yeah, this site is best viewed in 16 Bit or higher, with the resolution on 800*600. Thanks to Planet Quake for there great help and support with hosting. Best viewed with Netscape 4 or IE 3 designed