differentiate between constants and variables in QBASIC
Answers
Answered by
12
In this C programming language tutorial we take a look at variables and constants.
Variables
If you declare a variable in C (later on we talk about how to do this), you ask the operating system for a piece of memory. This piece of memory you give a name and you can store something in that piece of memory (for later use). There are two basic kinds of variables in C which are numeric and character.
Numeric variables
Numeric variables can either be of the type integer (int) or of the type real (float). Integer (int) values are whole numbers (like 10 or -10). Real (float) values can have a decimal point in them. (Like 1.23 or -20.123).
Character variables
Character variables are letters of the alphabet, ASCII characters or numbers 0-9. If you declare a character variable you must always put the character between single quotes (like so ‘A’ ). So remember a number without single quotes is not the same as a character with single quotes.
Constants
The difference between variables and constants is that variables can change their value at any time but constants can never change their value. (The constants value is lockedfor the duration of the program). Constants can be very useful, Pi for instance is a good example to declare as a constant
Variables
If you declare a variable in C (later on we talk about how to do this), you ask the operating system for a piece of memory. This piece of memory you give a name and you can store something in that piece of memory (for later use). There are two basic kinds of variables in C which are numeric and character.
Numeric variables
Numeric variables can either be of the type integer (int) or of the type real (float). Integer (int) values are whole numbers (like 10 or -10). Real (float) values can have a decimal point in them. (Like 1.23 or -20.123).
Character variables
Character variables are letters of the alphabet, ASCII characters or numbers 0-9. If you declare a character variable you must always put the character between single quotes (like so ‘A’ ). So remember a number without single quotes is not the same as a character with single quotes.
Constants
The difference between variables and constants is that variables can change their value at any time but constants can never change their value. (The constants value is lockedfor the duration of the program). Constants can be very useful, Pi for instance is a good example to declare as a constant
iarif5488:
thank you but give short answer
Answered by
1
Answer:
A quantity in a computer program which does not change its value during the execution of the program is called a constant and the quantity which may change its values during the execution of the program is called variable.
Please mark me as brainlest
Similar questions