error: ISO C forbids nested functions – What’s wrong?

You missed a closing braces for for loop in the function arraycpy

void arraycpy(int *dest, int *src, int n)
{
    int i;
    int *src_p, *dst_p;

    src_p = (int*)src;
    dst_p = (int*)dest;

    for (i = 0; i < n; i++) {
        *(dst_p+i) = *(src_p+i);
    }
 // ^^^
}

So, the next braces is being taken as the braces for the for loop, and thus when you define the next function, it is being defined inside the next function arraycpy

Leave a Comment