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

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

 
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

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

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

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

 
by Dinesh Thakur Category: Control Structures

In some situations we may have to change the order of execution of statements based on certain conditions , or repeat a group of statements until certain specified conditions are met. For these situation C provides decision making statements also know as control statements. C has following control statements:

 
by Dinesh Thakur Category: Control Structures

1. Factorial of a number.
2. Prime or not
3. Odd or even
4. Exit

Once a menu item is selected the appropriate action should be taken and once this action is finished, the menu should reappear. Unless the user selects the 'Exit' option the program should continue to work. 

 
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