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
Post a Comment