answersLogoWhite

0

All programming languages provide 6 built-in comparison operators:

< less than

<= less than or equal

== equal (denoted = in some languages)

!= not equal (denoted <> in some languages)

> greater than

>= greater than or equal

In C Programming, to compare any two primitive data types (X and Y) for equality, we would use the equality operator as per the following expression:

X==Y

This expression evaluates true whenever X and Y hold the same logical value, otherwise it evaluates false. We can use this expression within any statement where the expression true or false would be expected. For example:

if (X==Y) {

// do something when X and Y are equal (where X==Y evaluates true)

} else {

// do something when X and Y are not equal (where X==Y evaluates false)

}

Note that the built-in == operator can also be applied to any combination of primitive data types that can be implicitly promoted or converted to a common type. For example, comparing an int with a double will implicitly convert the int to a double, thus we are actually comparing two doubles, as per the following "named operator":

bool is_equal (int X, double Y) {

return X==Y; // implicitly the same as: return (double) X==Y;

}

User Avatar

Wiki User

7y ago

What else can I help you with?

Continue Learning about Engineering
Related Questions

How do you determine if two primitives are equal in Java?

There are 9 definitions of primitive within mathematics - according to Wikipedia!


What is a constant in computer?

In computer terms (especially in programming), a constant is a piece of data that has a set value which cannot be changed. For example, 1 and 3 are constants - they will always equal their respective values. Constants can also be set, so you could make: piValue a constant equal to 3.14.


Is microprocessor equal to computer?

yes it's equal to computer


What is 1000 to the power of 5 equal?

1000 to the power of 5 is equal to 1,000,000,000,000. This can be calculated by multiplying 1000 by itself 5 times, which results in 1 followed by 12 zeros. This large number is obtained by multiplying 1000 by itself repeatedly, which is a common operation in mathematics and computer programming.


What is the difference between a equals equals 0 and a equals 0?

One equals is used in an equation which is true, such as 5 + 3 = 8 Equals equals is used in computer programming as a question as to whether 2 things are equal. Like If x == 4 perform this operation ... If you are referring to 'C' language programming: A single equal sign is an assignment, a double equal sign is a comparison. a = 7; /* An assignment. You are assigning the value of 7 to the variable called 'a' */ if (a == 7) /* A comparison. You are checking if the variable 'a' has the value of 7 */


Which operator is used to determine that the operands are not exactly of the same value?

The operator used to determine that the operands are not exactly of the same value is the inequality operator (!=). This operator checks if the values of two operands are not equal, returning true if they are different and false if they are the same. In some programming languages, you may also see the !== operator, which checks both value and type inequality.


Why do letters equal numbers on your TI 83?

The letters are used for programming Or for entering numbers in hexadecimal notation


What does n e stand for?

'n e' typically stands for &quot;not enough&quot; or &quot;not equal to.&quot; It is commonly used in mathematics or programming to indicate that a certain condition is not met or that two values are not equal. However, without more context, it is difficult to determine the exact meaning of 'n e'.


Greater than or equal to symbol?

Greater than or equal symbol means the left side number is greater than or equal to right side number. It is mostly used in programming.


How do you determine the magnitude of two equal forces?

To determine the magnitude of two equal forces, you can simply multiply the magnitude of one force by 2, as they are equal. This is because the total force is the sum of the individual forces acting in the same direction.


What is the strong duality proof for linear programming problems?

The strong duality proof for linear programming problems states that if a linear programming problem has a feasible solution, then its dual problem also has a feasible solution, and the optimal values of both problems are equal. This proof helps to show the relationship between the primal and dual problems in linear programming.


How do you determine if two fractions are equal?

By reducing them to their lowest terms