About 405,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. Passing an array by reference in C? - Stack Overflow

    Jan 5, 2014 · This example demonstrates passing a primitive type by reference (using a pointer which is passed by value) but doesn't demonstrate passing an array of structs by reference as …

  3. 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 …

  4. How to pass 2D array (matrix) in a function in C?

    @ChristianMann Rather, the reason the array syntax at all works, is because the compiler adjusts the array declaration in the parameter to a pointer to the first element, in this case int (*)[N].

  5. 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 …

  6. 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).

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

    Nov 21, 2011 · Define struct Items outside of main. 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 …

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

    Jul 4, 2016 · Yes, it's possible. Have you tried it? Pass &x, or even passing x causes implicit conversion ('decay') to a pointer. As such, it doesn't achieve anything really different from …

  9. How many ways are there to pass char array to function in C?

    Sep 3, 2015 · But note that array pointers are mainly just there to make the C language more consistent. There's very few reasons why you would ever want to pass an array pointer to a …

  10. How to pass a 2D array by pointer in C? - Stack Overflow

    May 23, 2013 · I am learning C and am having trouble passing the pointer of a 2D array to another function that then prints the 2D array. Any help would be appreciated. int main( void ){ …

Refresh