What is wrong with this statement? It doesn't copy right.
memcpy(new_board1, board, sizeof(board));
What is wrong with this statement? It doesn't copy right.
memcpy(new_board1, board, sizeof(board));
memcpy accepts two memory addresses in form of pointers (destination and source) and the number of bytes to be copied. Now, sizeof doesn't return the size of the memory block a pointer points to, but the size of the pointer itself - either 4 bytes on a 32bit OS, or 8 bytes on a 64bit OS.
sizeof returns the size, in bytes, of the object passed as its parameter. In case only a type is passed it returns the size of an object of that type. int *ptr = malloc(1000 * sizeof *ptr); int data[1000]; memcpy(ptr, data, sizeof data);