lundi 25 novembre 2019

As Binary literal is introduced in c++14..but it could used in C++98/C++03/C++11

Please see below code snippet it is compiled and run fine in C++03/C++11.

  #include <iostream>
  using namespace std;

  int main(){

          int a = 0b1111;
          cout<<"a:: "<<a<<endl;

          int var = 4;
          if(var == 0b0100)
                 cout<<"True----------------\n";
          else
                 cout<<"Flase---------------\n";

          return 0;
 }

Output:- a:: 15 True----------------

Please help me what is the difference in C++03 and C++14 binary literal Even Binary literal could be used in c++03/C++11.

Aucun commentaire:

Enregistrer un commentaire