Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ declaring and initializing strings

string s1;                  // empty
string s2 {"Frank"};        // Frank
string s3 {s2};             // Frank
string s4 {"Frank", 3};     // Fra
string s5 {s3, 0, 2};       // Fr
string s6 (3, 'X');         // XXX
 
PREVIOUS NEXT
Tagged: #declaring #initializing #strings
ADD COMMENT
Topic
Name
2+4 =