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 [Read more…] about Const and volatile Qualifiers in C
Boolean Operators in C
Boolean operators AND, OR, and NOT are used to manipulate logical statements. Boolean operators are the core operators used in digital control systems as well as computer systems. AND and OR are binary operators, while NOT is a unary operator. Let A and B be two logical statements or variables representing logical statements. If a logical statement is true it may be assigned the value 1, and if a logical statement is false it may be assigned the value 0. Table gives details of the three operators AND, OR, and NOT. [Read more…] about Boolean Operators in C
Composite Assignment Operators in C
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= (such as+ =),it may result in an error. [Read more…] about Composite Assignment Operators in C
Arithmetic Operators in C
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. [Read more…] about Arithmetic Operators in C
sizeof() operator in C
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. [Read more…] about sizeof() operator in C
Bitwise Operators in C
All the objects stored in a computer are ultimately converted into binary numbers, sequences of 0s and 1s. Each digit in a binary number store on one bit of the computer memory. A bit define as the smallest unit of memory in a computer. The computer manipulates a number by manipulating the bits on which the number stored. In control systems also we often need to use operators to manage bits. [Read more…] about Bitwise Operators in C
Relational and Equality Operators
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. [Read more…] about Relational and Equality Operators
Ternary Operator in C
The conditional expression operator (?:) is the only ternary operator in C language. It takes three operands and is used to evaluate one of the two alternative expressions depending on the outcome of a test expression. The controlling condition of the ternary operator must evaluate to boolean, either true or false . If the condition is true , the ternary operator returns expr1 , otherwise it returns the expr2 . [Read more…] about Ternary Operator in C
What is Arithmetic operator in C language?
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. [Read more…] about What is Arithmetic operator in C language?
What is Precedence and Associativity of Operators?
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. [Read more…] about What is Precedence and Associativity of Operators?
What is Operators in C language?
Operators are used to connect operands, i. e., constants and variables, to form expressions. [Read more…] about What is Operators in C language?
Define Operator, Operand, and Expression in ‘C’
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 [Read more…] about Define Operator, Operand, and Expression in ‘C’
What is Precedence of Operators
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 [Read more…] about What is Precedence of Operators
What is the difference between ++var and var++
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. [Read more…] about What is the difference between ++var and var++
What is the functionality and restrictions of Modulus 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. [Read more…] about What is the functionality and restrictions of Modulus Operator
How does the prefix and postfix operator on expression
The operators present in prefix and postfix are [Read more…] about How does the prefix and postfix operator on expression
Which bitwise operator is suitable for checking whether a particular bit is ON or OFF
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. [Read more…] about Which bitwise operator is suitable for checking whether a particular bit is ON or OFF