Computer Science SSC II Notes - AKUEB
8.4.1 Differentiate between a constant and a variable in C programming language;
Constant:
Constants are fixed values that do
not change during the execution of a program. They are also referred to as
literals. Constants can be of different types, such as integer constants,
floating-point constants, character constants, and string
literals. Constants provide a way to represent fixed values that remain the
same throughout the program. For example:
int x=6; // the value of x is
constant [6]
Variable:
Variables are used to store and
manipulate data that can change during the execution of a program. They
provide a way to represent dynamic or varying values. Variables have a specific
type, which determines the kind of data they can store, such as integers,
floating-point numbers, characters, or custom-defined data types. For
example:
int x; // x is a variable of
integer format [Its value can change]
.png)
.png)
Comments
Post a Comment