C++11 String Initialization

As you might expect by now, C++11 enables list-initialization for C-style strings and string objects:

char first_date[] = {"Le Chapon Dodu"};char second_date[] {"The Elegant Plate"};string third_date = {"The Bread Bowl"};string fourth_date {"Hank's Fine Eats"};

Get C++ Primer Plus now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.