Arrays

How can I achieve this in CPP?

$random_array_of_strings  = ["string_1", "string_2", "string_3"] ;

string "name" ["size of array"];
string colors[4];
string colors[4] = {"red", "blue", "yellow", "green"};

For other ways of achieving this, see:

syntax:
string arrayname [n] = { index 0, index 1, index 2, … , index n } // [n] amount of array
// index[ … ] = n - 1

for instance:

string score [ 4 ] = { 88, 90, 97, 99, }
or you can write
string score [ ] = { 88, 90, 97, 99 } score will set amount itself.

Privacy & Terms