Friday, February 10, 2012

initializer list c++

initializer list c++:

Initializing structs member by member is a little cumbersome, so C++ supports a faster way to initialize structs using an initializer list. This allows you to initialize some or all the members of a struct at declaration time.

 struct ccplusplus {  
    string strSiteName;  
    string strOwner;  
    int nAge;  
    string strLocation;  
    string strDateCreated;   
ccplusplus info = {"", "Saurabh Gupta", 24, "India", "19-Dec-2011"};


No comments:

Post a Comment