Answers for "how to modify an element in an array c"

C
3

How to change an array in a function in c

// Change the pointer of the array
void change(int **array, int length)
{
    *array = malloc(length * sizeof(int));
    if (*array == NULL)
        return;
    for (int i = 0 ; i < length ; i++)
        (*array)[i] = 1;
}
Posted by: Guest on July-02-2020

Code answers related to "how to modify an element in an array c"

Code answers related to "C"

Browse Popular Code Answers by Language