So I have the following:
int from[2][3] = { {1,2,3}, {2,3,4} };
int into[3];
into = memcpy(into, from[0], 3 * sizeof(*into));
I want to copy 'from' in to the array 'into' so that 'into' = { 1, 2, 3}
I am trying to do the above using memcpy (i know that it already works with a loop) but I cant seem to get it working.
I keep on getting the error :
error: incompatible types when assigning to type ‘int[3]’ from type ‘void *’
I found a link to this question:
How do I copy a one-dimensional array to part of another two-dimensional array, and vice-versa?
and changed my code (Above) but i still get the error.
I am still clueless, I have solved my problem in another manner but curiosity I would like to know how it is done as from the previous post I know it is possible.