Elements of C Language. (2022)

Elements of C

 Here we shall introduce the basic elements of the C language. These are actually the building blocks of every C program. The Proper use of these basic elements helps a lot to write effective C programs.



_Identifiers_

Identifiers are the names used to represent variables, constants, types, functions, and labels in the program. The first 31 characters of identifiers are significant to C compiler.
Example:
int amount;

double totalbalance;

In the above example, amount and totalbalance are identifiers, and int, and double are keywords.

 There are two types of identifiers :

1. Standard Identifiers
2. User-defined Identifiers

Standard identifiers

Standard identifiers have some special meanings in C, but these can be redefined to use in the program for other purposes, however, this practice is not recommended.
Examples of standard identifiers include printf and scanf, which are names of input/output functions defined in stdio.h.

User-defined Identifiers

In a C program, the programmer may need to access memory locations for storing data and program results. For this purpose memory cells are named that are called user-defined identifiers.
Keywords: Keywords or reserved words are the words, which have predefined meaning in C. There are 32 words defined as keywords in C.

Variables: Variables are named memory locations (memory cells), which are used to store the program's input data and its computational results during program execution.

Constants: A constant is a quantity whose value can not be changed. There are two types of constants numeric constants and Character constants.

Data Type

In C, the data type defines a set of values and a set of operations on those values.

The data type for integers: Int, short, long
The data type for Floating-point numbers: float, double, long double
The data type for Characters: char

Operators in C

Arithmetic operators: used to perform arithmetic operators

Relational operators: used to compare two values

Logical Operators: used to combine two or more relational expressions to construct compound expressions.

Assignment operators: used to store a value or a computational result in a variable.

Increment & Decrement operators: used to increase or decrease the value of its operand by one.

Compound Assignment Operators: used to increment or decrement the value of their operand by other than one.

----------------------------------------------------------[]---------------------------------------------------------
Feel free to ask any questions in the comment section.

Here is the second article on C-Language. 

Article No. 3 on C-language will be uploaded soon.

Post a Comment

0 Comments