About 296,000 results
Open links in new tab
  1. Array of Strings in C++ - GeeksforGeeks

    Feb 26, 2025 · It is initialized with 3 strings which are then printed using loops. The general syntax of array of strings is: where arr_name is the name assigned to the array and size is the desired …

  2. c++ string array initialization - Stack Overflow

    Mar 9, 2012 · Prior to C++11, you cannot initialise an array using type []. However the latest c++11 provides (unifies) the initialisation, so you can do it in this way: string* pStr = new …

  3. How to declare an array of strings in C++? - Stack Overflow

    Jan 28, 2016 · You can concisely initialize a vector<string> from a statically-created char* array: char* strarray[] = {"hey", "sup", "dogg"}; vector<string> strvector(strarray, strarray + 3); This …

  4. How can I initialize a string array in C? - Stack Overflow

    Aug 13, 2021 · To initialize all the strings to be empty strings, use: char arr[10][2] = {0}; If you need to initialize them to something different, you'll have to use those values, obviously.

  5. Initializing static array of strings (C++)? - Stack Overflow

    Sep 4, 2009 · As the compiler say, you're trying to define a static member of MyClass that would be a const char* array named enumText. If you don't have it's declaration in the class, then …

  6. Array of strings initialization in c++ - Stack Overflow

    Feb 26, 2014 · Technically, you cannot initialise it after the declaration. The nuance is important, because in your second example you assign to the individual strings. Now, you want to assign …

  7. Array initialization - cppreference.com

    Oct 16, 2022 · When initializing an object of array type, the initializer must be either a string literal (optionally enclosed in braces) or be a brace-enclosed list of initialized for array members:

  8. Understanding C++ String Array - DigitalOcean

    Aug 4, 2022 · Syntax: To declare an array of string using ‘string’ keyword. Further, we can initialize the array of string using the below syntax: Example 1: string fruits[5] = { "Grapes", …

  9. Efficient Ways To Work With Arrays Of Strings In C++

    May 14, 2024 · When it comes to initializing an array of strings, there are a few different methods you can use. One common way is to use an array literal, which allows you to declare and the …

  10. C++ Initialize Array - Tutorial Kart

    In this C++ tutorial, you will learn how to initialise an array with values of a specific datatype, and go through some examples of how to initialize arrays of different datatypes. To initialize a C++ …

Refresh