C: create an array of array with memcpy -


i'm trying create , fill array of array. code i've written:

int b[4] = {100, 100, 200, 300}; int a[2][4];  int main(){     memcpy(a[0], b, sizeof(int));     printf("%i", a[0][2]); 

i shoulde 200, instead 0...how can solve it?

you're copying 1 int b. need copy of b a[0] this

int b[4] = {100, 100, 200, 300}; int a[2][4];  int main(){     memcpy(a[0], b, sizeof(b));     printf("%i", a[0][2]); } 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -