c basic1
c basic1
Variable is a name assign to a storage area that the program can manipulate. A variable type
determines the size and layout of the variable's memory.
It also determines the range of values which need to be stored inside that memory and nature of
operations that can be applied to that variable.
There are three places where variables you can declare variable programming language:
1. A variable name may consists of letters, digits and the underscore ( _ ) characters.
2. A variable name must begin with a letter. Some system allows to starts the variable
name with an underscore as the first character.
4. Uppercase and lowercase are significant. That is the variable Totamt is not the same
as totamt and TOTAMT.
n1 M_age AMOUNT
Naming Conventions
Generally, C programmers maintain the following conventions for naming variables.
Local Variable
int add()
{
int a =4;
int b=5;
return a+b;
}
Global Variable
A Global Variable in the program is a variable defined outside the subroutine or function. It has
a global scope means it holds its value throughout the lifetime of the program. Hence, it can be
accessed throughout the program by any function defined within the program, unless it is
shadowed.
Example:
int a =4;
int b=5;
int add()
{
return a+b;
}
Data: Data are characteristics or information, usually numerical, that are collected through
observation. In a more technical sense, data is a set of values of qualitative or quantitative
variables about one or more persons or objects, while a datum (singular of data) is a single value
of a single variable.
Information: Information is associated with data, as data represent values attributed to
parameters, and information is data in context and with meaning attached. Organized data is
called Information.
Bit: A bit is a binary digit, the smallest increment of data on a computer. The bit represents a
logical state with one of two possible values. It's a single unit of information that has a value of
either 0 or 1.
Byte: The byte is a unit of digital information that most commonly consists of eight bits.
Constant: A constant can be defined as a fixed value, which is used in algebraic expressions and
equations. A constant does not change over time and has a fixed value. For example, the size of a
shoe or cloth or any apparel will not change at any point.
In an algebraic expression, x+y = 8, 8 is a constant value, and it cannot be changed.
Constant Variables
A constant does not change its value over time. A variable, on the other hand, changes its
value dependent on the equation.
Constants are usually written in numbers. Variables are specially written in letters or
symbols.
Constants usually represent the known values in an Variables, on the other hand, represent the
equation, expression or in line of programming. unknown values.
Constants are used in computer programming. Variables also have its uses in computer
programming and applications.