About 243,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. 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] (that …

  3. 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 and modify the …

  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 dimensions: 1) …

  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 the called …

  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 ]) attached to …

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

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

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

    Dec 14, 2014 · I want to pass the B int array pointer into func function and be able to change it from there and then view the changes in main function #include <stdio.h> int func(int *B[10]){ } int mai...

  10. 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 (unless it's …