7.3k views
4 votes
String name[4] = {"Ali", "Bilal", "Omer", "Ayesha"}; cout << name[2];

1 Answer

1 vote

The above code is written in C++ and it is one that declares an array of strings named name with a size of 4. Each element of the array is one that is start up with a string literal.

What is the code?

In programming, C++ is said to be one that a person can use the #define directive to create a macro, which is a way to define a symbolic name or alias for a constant value or expression.

The cpp code will be:

#include <iostream>

int main() {

// Declare an array of strings named 'name' with a size of 4

std::string name[4] = {"Ali", "Bilal", "Omer", "Ayesha"};

// Print the third element (index 2) of the 'name' array

std::cout << name[2] << std::endl;

return 0;

}

string name[4] = {"Ali", "Bilal", "Omer", "Ayesha"}; cout << name[2]; which code is the name written above

User RHSeeger
by
7.9k points