## Assignment Operator in C

by Dinesh Thakur Category: Operator

We have used the assignment operator (=), which is often called equal to in algebra. On the left of this operator we write the name of variable or l-value to which a value is to be assigned, and on right side we write the value to be assigned to it or r-value. The l-value is the memory segment in which the r-value is stored. Let A, B, and ch is the names of three variables declared as given below.

## Arithmetic Operators in C

by Dinesh Thakur Category: Operator

There are five arithmetic operators, +, -, *, I, and %, which respectively represent the processes of addition, subtraction, multiplication, division, and modulus. The modulus operator (%) gives the remainder when one integer is divided by another integer. All of the five operators have been described with examples of codes in Table.

## sizeof() operator in C

by Dinesh Thakur Category: Operator

The sizeof operator is another method to determine the storage requirements of any data type of variable during the execution of a program. For example, we can use the expression.

## Bitwise Operators in C

by Dinesh Thakur Category: Operator

All the objects that are stored in a computer are ultimately converted into binary numbers which are sequences of 0s and 1s. Each digit in a binary number is stored on one bit of the computer memory. A bit is defined as the smallest unit of memory in a computer. In fact, computer manipulates a number by manipulating the bits on which the number is stored. In control systems also we often need to use operators to manipulate bits.

## Logical Operators in C

by Dinesh Thakur Category: Operator

The C language provides three logical operators that can be used to join relational and equality expressions and form complex Boolean expressions, i. e., expressions with operands having true or false values. These operators include logical AND (&&), logical OR (||) and logical NOT (!). They are summarized in Table.

## Relational and Equality Operators

by Dinesh Thakur Category: Operator

The C language provides four relational and two equality operators for comparing the values of expressions. The relational operators are less than (<), greater than (>), less than or equal to (<=) and greater than or equal to (>= ). The equality operators are equal to (==) and not equal to ( ! =). These operators are binary infix operators, i. e., they are used in the form a op b, where a and bare operands (constants, variables or expressions) and op is a relational or an equality operator. Table summarizes these operators.

## What is conditional expression operator(ternary operator)?

by Dinesh Thakur Category: Operator

The conditional expression operator (? :) is the only ternary operator in the C language. The conditional selection operator(? :) is more convenient to use than if-else provided there are only two options to choose from. It takes three operands and is used to evaluate one of the two alternative expressions depending on the outcome of a test expression as shown below.

## What is Arithmetic operator in C language?

by Dinesh Thakur Category: Operator

Arithmetic operators are used to perform arithmetic operations on arithmetic operands, i. e., operands of integral as well as floating type. Recall that an integral type includes all forms of char and int types, whereas the floating-point types include the float, double and long double types. These operations include addition (+), subtraction (- ), multiplication (*), division (!), modulo arithmetic (%), increment (++), decrement (-- ), unary plus (+) and unary minus (- ). They can be grouped into three categories: unary operators, multiplicative operators and additive operators. The arithmetic operators are summarized in Table.

## What is Precedence and Associativity of Operators?

by Dinesh Thakur Category: Operator

The operator precedence and associativity rules specify the order in which operators in an expression are bound to the operands. These rules enable us to interpret the meaning of an expression in an unambiguous manner.

## What is Operators in C language?

by Dinesh Thakur Category: Operator

Operators are used to connect operands, i. e., constants and variables, to form expressions.

## Define different types of Operators.

by Dinesh Thakur Category: Operator

An operator is a symbol which helps the user to command the computer to do a certain mathematical or logical manipulations. Operators are used in C language program to operate on data and variables. C has a rich set of operators which can be classified as

## Define Operator, Operand, and Expression in 'C'

by Dinesh Thakur Category: Operator

An operator is a symbol which helps the user to command the computer to do a certain mathematical or logical manipulations. Operators are used in C language program to operate on data and variables. C has a rich set of operators which can be classified as

## What is Precedence of Operators

by Dinesh Thakur Category: Operator

When number of operators occurs in an expression the operator which is to be evaluated first is judged by applying priority of operators. The arithmetic operators available in C are

-  used for Subtraction

* used for Multiplication

/ used for Division

## What is the difference between ++var and var++

by Dinesh Thakur Category: Operator

The ++ operator is called the increment operator. When the operator is placed before the variable (++var), the variable is incremented by 1 before it is used in the expression. When the operator is placed after the variable (var++), the expression is evaluated, and then the variable is incremented by 1.

## What is the functionality and restrictions of Modulus Operator

by Dinesh Thakur Category: Operator

When a division is performed the remainder of the operation is given by modulus operator. The modulus operator is denoted in c by symbol %. Say for instance we have two integer values x and y and then the operation x % y called as x modulus y gives the result as (x- (x / y) * y).  Say if x=18 and y =5 the x % y gives value as (18- (18 / 5) * 5) which gives (18-15) which results in 3 in other words the remainder of the division operation.

## How does the prefix and postfix operator on expression

by Dinesh Thakur Category: Operator

}The operators present in prefix and postfix are

• prefix increment operator denoted by ++
• prefix decrement operator denoted by --
• postfix increment operator
• postfix decrement operator

## Which bitwise operator is suitable for checking whether a particular bit is ON or OFF

by Dinesh Thakur Category: Operator

Example: Suppose in byte that has a value 10101101 . We wish to check whether bit number 3 is ON (1) or OFF (0) . Since we want to check the bit number 3, the second operand for AND operation we choose is binary 00001000, which is equal to 8 in decimal.

## C calculating Integration using Trapezoidal Rule

by Dinesh Thakur Category: Control Structures

The trapezoidal rule is the simplest method to approximate the definite integral of a function f(x) over the interval [a, b]. Given N equally space points (with a spacing of h) X0, X1, ..., XN such that X0 = a and XN = b, the integral of f(x) can be approximated as the sum

## C Program for string encryption using Caesar cipher (shift encoding).

by Dinesh Thakur Category: Control Structures

C program to encrypt text using one of the simplest ciphers known as the "Caesar cipher." In this encryption scheme, we shift all characters by a given offset. For example, if we use an offset of 4, every occurrence of 'A' will be replaced by 'E', every occurrence of 'B' will be replaced by 'F', and so forth. The encrypted text can be decrypted by using the reverse process if know the offset used for the encryption.

## C Program for Rational Approximations for Real Numbers

by Dinesh Thakur Category: Control Structures

The C program computes the rational approximation to a given real number, i.e., given a real number val, the program computes a pair of integers N and D such that the fraction N/D is a good approximation to val. To do so, we use the following series of steps.

Page 3 of 16