by Dinesh Thakur Category: Operator

Arithmetic operators may be combined with the assignment operator to obtain composite assignment operators. An arithmetic operator is written first followed by the assignment operator but not vice versa. In all the composite operators there should not be any blank space between the symbols. For instance, in+= if we give space between+ and= (suchas+ =),it may result in an error.

 
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.

 
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.

 
by Dinesh Thakur Category: Operator

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

 
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.

 
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.

 
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.

 
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.

 
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.

 
by Dinesh Thakur Category: Operator

The const qualifier tells the compiler that the variable's value should not be changed once it has been initialized. If we declare a const variable as

 

Page 2 of 2

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content