# Do you think operator < is faster than <= in C/C++?

C++ProgrammingServer Side Programming

#### C in Depth: The Complete C Programming Guide for Beginners

45 Lectures 4.5 hours

#### Practical C++: Learn C++ Basics Step by Step

Most Popular

50 Lectures 4.5 hours

#### Master C and Embedded C Programming- Learn as you go

66 Lectures 5.5 hours

No, the operator < takes same time to execute as operator <= takes. Both operators execute similarly and take same execution time to perform the execution of instructions.

There is a jcc( jump instruction) at the time of compilation and depending upon the type of comparison, it jumps to the instructions. The following are some of the comparison type −

• je − Jump if equal

• jg − Jump if greater

• jne − Jump if not equal

• jge − Jump if greater or equal

There is only one difference between operator < and operator <= that the operator < executes ‘jg’ instruction while the operator <= executes ‘jge’ instruction. But both operators take same time to execute.

Here is an example of operator < and <= in C language,

## Example

Live Demo

#include<stdio.h>
int main() {
int a = 8;
int b = 8;

if(a<b)
printf("b is greater than a\n");

if(a<=b)
printf("b is greater or equal to a");
else
printf("b is smaller than a");
return 0;
}

## Output

Here is the output

b is greater or equal to a
Updated on 25-Jun-2020 09:45:25