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

    Jul 4, 2011 · 145 I wrote a function containing array as argument, and call it by passing value of array as follows.

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

  3. Correct way of passing 2 dimensional array into a function

    In C language, 2D array is just an array of arrays. Because of that, you should pass the function a pointer to the first sub-array in the 2D array. So, the natural way, is to say int (*p)[numCols] …

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

    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 …

  5. Passing an array by reference in C? - Stack Overflow

    In C arrays are passed as a pointer to the first element. They are the only element that is not really passed by value (the pointer is passed by value, but the array is not copied). That allows …

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

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

    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 ){ char array[50][50];...

  8. 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.

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

  10. Passing multidimensional arrays as function arguments in C

    In C can I pass a multidimensional array to a function as a single argument when I don't know what the dimensions of the array are going to be? Besides, my multidimensional array may …