Friday, 4 July 2014

new initializtion concepts of c+03 standard

 
still intializing the variable using the equal sign.

 C++03 standard introduced the new way of intializing the variable.

You can use the paranthesis to initialize the variable now.

#include<iostream>
int main()
{
   
    int n(88);
    std::cout<<n;
   
    double d(512.5415);
    std::cout<<d;
   
   
    return 0;
}


In c++11 standard you can use curly braces to initialize the variable.


#include<iostream>
int main()
{
   
    int n{88};
    std::cout<<n;
   
    double d{512.5415};
    std::cout<<d;
   
   
    return 0;
}