About 342,000 results
Open links in new tab
  1. How to add element to C++ array? - Stack Overflow

    Nov 13, 2016 · Arrays in C++ cannot change size at runtime. For that purpose, you should use vector<int> instead.. vector<int> arr; arr.push_back(1); arr.push_back(2); // arr.size() will be …

  2. Adding integers to arrays in C++? - Stack Overflow

    Mar 28, 2016 · how does "numbers+1" work, given numbers[] is an int array and you shouldn't be able to add an integer to an int[] constant? There's no int[] constant. numbers is decayed to a …

  3. How to add all numbers in an array in C++? - Stack Overflow

    Nov 15, 2014 · The easiest way I can see to do this is to use a loop. The bonus is that you can use it on any integer array without rewriting much code at all.

  4. Can we add an integer to an array in c++ - Stack Overflow

    Aug 30, 2020 · Can we add integers to an array in c++ as given in the else part of the left rotate function while passing the arguments (arr+n-d)? How can we add integers to an array? I tried …

  5. C++ add int to int array - Stack Overflow

    Nov 17, 2016 · C++ add int to int array. Ask Question Asked 8 years, 6 months ago. Modified 8 years, 6 months ago. Viewed ...

  6. c++ - Declaring array of int - Stack Overflow

    int y[10]; - Creates an array of size 10 integers on BSS/Data segment. - You do not have to explicitly delete this memory. - Since it is declared global it is accessible globally. int *z = new …

  7. c++ - Append an int to char* - Stack Overflow

    Instead of using a fixed constant size for the string, you might want to use something like <base size>+sizeof(int)*3+1 (3 = ceil(8*log10(2)), 1 for '-'). This should always work (also in case of …

  8. How to create a dynamic array of integers in C++?

    Aug 11, 2023 · The answers above are all good for assigning one-dimensional int-arrays. Anyhow, I want to add that it is also possible to do this for multi-dimensional arrays you'd …

  9. Can i push an array of int to a C++ vector? - Stack Overflow

    Jun 15, 2012 · vector <vector<int>> (it's basically a two dimensional vector.It should work in your case) vector< string > (string is an array of characters ,so you require a type cast later.It can …

  10. How to add a char/int to an char array in C? - Stack Overflow

    Dec 3, 2015 · Program will fill it later. The problem just contains to add a char/int to an char Array. In that case, snprintf() can handle it easily to "append" integer types to a char buffer too. The …