what's the difference between != and <>

+1 Yan Yan · January 28, 2015
As far as I can consider, both of them present "not equal to", but what is the difference between them?

Post a Reply


Oldest  Newest  Rating
+2 Jake Scaife · January 29, 2015
They can be used interchangeably in most circumstances, however convention dictates that you should use != for most scenarios.
+2 M Uxi · January 28, 2015
Both Are Not Same.
!= means Not equal too. 
<> Less then Greater Than.

For Better Understanding you need to learn Relational Operators Topic .
Link is Here.

+1 Nicholas Eason · January 29, 2015
To be completely blunt, yeah they do the same thing. Something can't be less than/ greater than AND equal to another thing.
0 Dennis Siaw · January 29, 2015
The <> is used to declare a class template specialization in C++.
template <class T> class mycontainer { ... }; //generic class template
template <> class myClass<returntype> { ... }; //class template specialization

I don't think C++ uses <> as comparison operator.
I have encountered and used <> in SQL queries to mean not equal to, however in C++ you can best use the != operator to mean not equal to.

Hope it helps.
  • 1



Used in many types of software including music players, video games, and many large scale applications.

Bucky Roberts Administrator