About 386,000 results
Open links in new tab
  1. java - storing a string and int in 2d array - Stack Overflow

    Sep 27, 2014 · HashMap<String, Integer> map = new HashMap<>(); use its put(String, Integer) method to insert the values and get(index) to access the values. Note: You cannot store the …

  2. Multidimensional Arrays in C – 2D and 3D Arrays - GeeksforGeeks

    May 7, 2025 · We can visualize a two-dimensional array as one-dimensional arrays stacked vertically forming a table with 'm' rows and 'n' columns. In C, arrays are 0-indexed, so the row …

  3. C++ two dimensional array containing string and int

    Jan 6, 2016 · This sounds like you probably want an array (or vector) of structures, where each structure contains a string and an int: struct person { int age; std::string name; }; …

  4. Different Ways To Declare And Initialize 2-D Array in Java

    Nov 13, 2024 · Any 2-dimensional array can be declared as follows: data_type: Since Java is a statically-typed language (i.e. it expects its variables to be declared before they can be …

  5. How can I create a two dimensional array that containts Ints and ...

    In C#, You cannot create a two dimensional array with two different data types, in your case, int and string. You can only create a two dimensional array of the same data type. If you require a …

  6. 6 ways to declare and initialize a two-dimensional (2D) String

    Oct 27, 2021 · Object [][] items = new String [3][]; items [0] = new Integer[]{1, 2, 4}; items [1] = new String []{"a", "b"}; items [2] = new Float[]{1.0f, 2.0f}; Here is a summary of different ways of …

  7. C++ Multidimensional Array - GeeksforGeeks

    May 16, 2025 · Elements of a 2D array have to be accessed using row and column indices inside [] square brackets. It is similar to matrix element position, but the only difference is that here …

  8. Two Dimensional (2D) Array of Strings in C - Know Program

    To declare an array of Strings in C, we must use the char data type. An example of two dimensional characters or the array of Strings is, Syntax:- Here the first index (row-size) …

  9. Consider a variable words, a 1D array of String references. What is the length of the array? What is the length of the word at index 2? • A 2D array is a 1D array of (references to) 1D arrays. …

  10. Here's one way to think about initializing a 2D array as an array of int arrays. This creates a 2D array with numRows rows and numCols columns. Ultimately, a 2D array is an array of arrays. …

Refresh