Why can’t I assign arrays as &a = &b?

You can’t assign arrays in C. You can copy them with the memcpy() function, declared in <string.h>:

int a[3];
int b[] = {1,2,3};

memcpy(&a, &b, sizeof a);

Leave a Comment