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

    Jul 4, 2011 · If I pass an array to a function . Say for example I made an array int a[10] and assigned each element random value . Now if I pass this array to a function using int y[] or int …

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

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

    Dec 14, 2014 · In func(B), you are just passing address of the pointer which is pointing to array B. You can do change in func() as B[i] or *(B + i). Where i is the index of the array. In the first …

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

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

    Oct 16, 2013 · So a pointer to an int is passed by value. Thus, doStuff gets a copy of a pointer to memory in main's stack frame. When it dereferences that pointer with ptr[1], it is following the …

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

    Sep 3, 2015 · Some will say that the the rationale is that you should never be allowed to pass arrays by value in C, for performance reasons. Well, tough luck, because you still can, despite …

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

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

    Jan 5, 2014 · In C, when an array identifier appears in a context other than as an operand to either & or sizeof, the type of the identifier is implicitly converted from "N-element array of T" to …

  9. c++ - Passing an array by reference - Stack Overflow

    ^ Pass array of 100 int by reference the parameters name is myArray; void Func(int* myArray) ^ Pass an array. Array decays to a pointer. Thus you lose size information. void Func(int …

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

    The array name is a pointer to the first element in the array. In the first code sample you have passed a pointer to the memory location containing the first array element. In the second code …

Refresh