Constants, Variables and Keywords C programming language
In the C programming language, constants are fixed values that cannot be changed during the execution of a program. Constants can be of various types, such as integers, floating-point numbers, characters, and strings.
For example, the following are constants in C:
3 // an integer constant
3.14 // a floating-point constant
'A' // a character constant
"Hello, world!" // a string constant
Variables are named storage locations in a computer’s memory where we can store and retrieve values. In C, variables must be declared before they can be used, and they must be given a specific data type. The data type determines the size and layout of the variable’s memory, as well as the values that the variable can hold.
For example, the following are variables in C:
int x; // an integer variable
float y; // a floating-point variable
char c; // a character variable
char s[100]; // a string variable
Keywords are reserved words in C that have special meanings and cannot be used as variable names or constants. Some common C keywords include int
, float
, char
, while
, if
, else
, and return
.
Here is a list of all the keywords in C:
auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while
Leave a Comment