About 1,350,000 results
Open links in new tab
  1. for loop - User input in 2D array (C++) - Stack Overflow

    Apr 25, 2018 · The proper C++ way to accomplish what you want is to use an std::vector, which a very powerful wrapper around C style arrays that automatically allocates and de-allocates memory for you (and a lot of other things).

  2. C++ Multidimensional Array - GeeksforGeeks

    Mar 6, 2025 · In C++, you can pass multidimensional arrays to functions. Since multidimensional arrays have more than one dimension, the function signature needs to account for all dimensions. Passing a 2D Array to a Function

  3. How to Take Input in Array in C++? - GeeksforGeeks

    Oct 5, 2023 · A 2D array is essentially an array of arrays, where each element of the main array holds another array. In this article, we will see how to pass a 2D array to a function. The simplest and most common method to pass 2D array to a function is by specifying the parameter as 2D array with row size and c

  4. How to Pass 2D Array to Functions in C++ - GeeksforGeeks

    Jan 2, 2024 · There exist many ways of passing a 2D array to functions in C++. Method 1 : Passing 2D Array with Rows and Columns return_type name ( array_type array_name[rows][coloumns], int rows, int col )

  5. Two Dimensional Array in C++ - DigitalOcean

    Aug 3, 2022 · In this section, we are going to learn how to pass a 2D array to any function and access the corresponding elements. In the code below, we pass the array a, to two functions show() and print() which prints out the passed 2D array.

  6. C++ Multidimensional Arrays (2nd and 3d arrays) - Programiz

    In this tutorial, we'll learn about multi-dimensional arrays in C++. More specifically, how to declare them, access them, and use them efficiently in our program.

  7. 2D array for user input in c++ - Stack Overflow

    Oct 25, 2015 · In your first loop, your j doesn't do anything, so it can be scrapped as the element in name and age you're trying to access is at the same location. In your second while loop, you have a problem incrementing your basket_count multidimensional array.

  8. How to create and use 2D arrays in C++ - IONOS

    Jan 8, 2025 · In C++, a 2D array is a data structure that arranges elements in a two-dimensional, table-like format. Unlike one-dimensional arrays, which simply store elements in a sequence, a 2D array organizes data into rows and columns.

  9. Two-Dimensional Array in C++ (with Examples) | Scaler Topics

    Jul 6, 2022 · We can use nested loops to insert data inside the two-dimensional arrays in C++. Let us see the implementation to see how we can insert data in two-dimensional arrays in C++.

  10. How can I input string in a 2D array in C++? - Medium

    Aug 31, 2023 · Here is how you can input a string in a 2D array in C++: // Declare a 2D array of strings. string arr[3][4]; // Input the strings into the array. for (int i = 0; i < 3; i++) { for (int j = 0; j <...

  11. Some results have been removed
Refresh