About 12,100,000 results
Open links in new tab
  1. How do I use arrays in C++? - Stack Overflow

    517 C++ inherited arrays from C where they are used virtually everywhere. C++ provides abstractions that are easier to use and less error-prone (std::vector<T> since C++98 and …

  2. syntax - C++ array initialization - Stack Overflow

    Dec 17, 2009 · Yes, this form of initialization is supported by all C++ compilers. It is a part of C++ language. In fact, it is an idiom that came to C++ from C language. In C language = { 0 } is an …

  3. c++ - 2D array vs array of arrays - Stack Overflow

    A two-dimensional array can be allocated like an object of any other type, either automatically ("on the stack", i.e., declared as a local object), or dynamically (via malloc()), or statically (defined …

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

    Jan 28, 2016 · I am trying to iterate over all the elements of a static array of strings in the best possible way. I want to be able to declare it on one line and easily add/remove elements from …

  5. How to add element to C++ array? - Stack Overflow

    Nov 13, 2016 · If you are writing in C++ -- it is a way better to use data structures from standard library such as vector. C-style arrays are very error-prone, and should be avoided whenever …

  6. c++ - How do I find the length of an array? - Stack Overflow

    Is there a way to find how many values an array has? Detecting whether or not I've reached the end of an array would also work.

  7. c++ - Default initialization of std::array? - Stack Overflow

    Both the c-style array and std::array are filled with integers of indeterminate value, just as plain_int has indeterminate value. Is there a syntax that will work on all arrays (including zero-sized …

  8. Initialization of all elements of an array to one default value in C++?

    Jul 1, 2009 · C++ Notes: Array Initialization has a nice list over initialization of arrays. I have a int array[100] = {-1}; expecting it to be full with -1's but its not, only first value is and the rest are 0's

  9. How to use std::sort to sort an array in C++ - Stack Overflow

    Mar 12, 2017 · How to use standard template library std::sort() to sort an array declared as int v[2000]; Does C++ provide some function that can get the begin and end index of an array?

  10. How do I declare a 2d array in C++ using new? - Stack Overflow

    Jun 2, 2009 · It will create an array of an allocated-type int [X] [Y]. This is a "hole" in C++'s type system, since the ordinary type system of C++ doesn't have array dimensions with sizes not …