About 885,000 results
Open links in new tab
  1. Passing an array as an argument to a function in C

    Jul 4, 2011 · Here is the natural extension of this question: How to pass a multidimensional array to a function in C and C++. And here are several of my approaches to that problem.

  2. c - Pass an array to a function by value - Stack Overflow

    VIII.6: How can you pass an array to a function by value? Answer: An array can be passed to a function by value by declaring in the called function the array name with square brackets ([ and …

  3. Passing an Array by reference in C - Stack Overflow

    An array passed to a function is converted to a pointer. When you pass a pointer as argument to a function, you simply give the address of the variable in the memory.

  4. C pass int array pointer as parameter into a function

    Dec 14, 2014 · You pass a pointer to an array of 10 int *, but func expects an int** (which is expected to be a pointer to the first element of an array of (10, presumably) int* s).

  5. How to pass 2D array (matrix) in a function in C? - Stack Overflow

    C does not really have multi-dimensional arrays, but there are several ways to simulate them. The way to pass such arrays to a function depends on the way used to simulate the multiple …

  6. Passing an array of structs in C - Stack Overflow

    Nov 21, 2011 · When passing an array to a function in C, you should also pass in the length of the array, since there's no way of the function knowing how many elements are in that array …

  7. Changing an array with a function in C? - Stack Overflow

    Sep 21, 2015 · All functions that look like they take arrays actually take pointers and it is illegal to declare a function returning an array. All parameters, including pointers, are always passed by …

  8. c - Passing whole array to a function - Stack Overflow

    Oct 16, 2013 · An array in C may be treated as a pointer to the first element of the array. The pointer is passed by-value (you cannot modify the value passed in), but you can dereference it …

  9. c - pass char array as argument - Stack Overflow

    Jul 30, 2012 · When you say foo (*array), you're decaying the array into a pointer to the first element, in order to dereference that element, giving you the first character. That's what you're …

  10. c - How to pass the address of an array to a function? - Stack …

    Jul 4, 2016 · As such, it doesn't achieve anything really different from passing a pointer to the first element. If the function can be passed different arrays, or each array's size isn't fixed, you …