Using memcpy for copying array