About 50 results
Open links in new tab
  1. How do I determine the size of my array in C? - Stack Overflow

    Sep 1, 2008 · An array sent as a parameter to a function is treated as a pointer, so sizeof will return the pointer's size, instead of the array's. Thus, inside functions this method does not work. Instead, …

  2. How do I declare and initialize an array in Java? - Stack Overflow

    Jul 29, 2009 · The third way of initializing is useful when you declare an array first and then initialize it, pass an array as a function argument, or return an array. The explicit type is required.

  3. How to create an array containing 1...N

    Why go through the trouble of Array.apply(null, {length: N}) instead of just Array(N)? After all, both expressions would result an an N -element array of undefined elements. The difference is that in the …

  4. Loop (for each) over an array in JavaScript - Stack Overflow

    Feb 17, 2012 · How can I loop through all the entries in an array using JavaScript?

  5. Loop through an array of strings in Bash? - Stack Overflow

    Jan 16, 2012 · Without them, the for loop will break up the array by substrings separated by any spaces within the strings instead of by whole string elements within the array. ie: if you had declare -a …

  6. What’s the difference between “new Array()” and “[]” (empty square ...

    Another difference is that when using new Array() you're able to set the size of the array, which affects the stack size. This can be useful if you're getting stack overflows (Performance of Array.push vs …

  7. Get all unique values in a JavaScript array (remove duplicates)

    I have an array of numbers that I need to make sure are unique. I found the code snippet below on the Internet, and it works great until the array has a zero in it. I found this other script here on

  8. How to randomize (shuffle) a JavaScript array? - Stack Overflow

    Depending on the implementation of sort, an element at the lowest array index might require more comparisons in order to get to the highest index than the element next to the highest index.

  9. How can I remove a specific item from an array in JavaScript?

    How do I remove a specific value from an array? Something like: array.remove(value); Constraints: I have to use core JavaScript. Frameworks are not allowed.

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

    Jun 2, 2009 · See this answer. Compilers like gcc that allow variable-length arrays as an extension to C++ can use new as shown here to get fully runtime-variable array dimension functionality like C99 …