selenium fastrack 2
selenium fastrack 2
Data Types
The C language supports different types of data. Each data may be
represented differently within the computer memory. Typical memory
requirements for each data will determine the possible range of values
for that data type.
The varieties of data types available allow the programmer to select the
type appropriate to the needs of the application as well as the machine.
C supports three categories of data types:
1. Primary data type
2. Derived data type
3. User defined data type.
Data types
Primitive data type Derived data type User defined data type
Integer Arrays Enumerated
Float Function Structures
Character Pointer Unions
Typedef
Variables are identifiers whose value changes during the execution of the
program. Variables specify the name and type information. The compiler
allocates memory for a particular variable based on the type.
Variables can be modified using the variable name or address of the
variable. The variable name must be chosen in a meaningful way. The
declaration of the variable must be done before it can be used in the
program.
Examples
2. int rollno;
3. float int_rate;
5. char char;
Variable Initialization
Syntax:
Example
1. int c = 10, d = c + 5;
3. char ch = ‘Y’;
5. float pi = 3.14;
CONSTANT AND VOLATILE VARIABLE
Constant variable
If we want that the value of a certain variable remain the same or remain
unchanged during the execution of a program, then it can be done only by
declaring the variable as a constant.
The keyword constant is then added before the declaration. It tells the
compiler that the variable is a constant. Thus, constant declared variables
are protected from modification.
Example
Volatile variable
The volatile variables are those variables that are changed at any time by
any other external program or the same program. The syntax is as
follows.
Example
volatile int b;
OPERATORS IN C
Types of Operators
1. Arithmetic Operators
2. Relational Operators
3. Logical Operators
4. Assignment Operators
7. Bitwise Operators
8. Special Operators
1.Arithmetic Operators
The arithmetic operators are used for numerical calculations between two
Constants
table
Example:
void main()
c=a-b;
printf(“%d”, c);
2.Relational Operators
Table
Syntax
table
diagram
diagram