Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<typename T, size_t n>
- void copy_array(T (&src)[n], T (&dst)[n])
- {
- for (size_t i = 0; i < n; i++)
- {
- dst[i] = src[i];
- }
- }
- int main()
- {
- char a1[6]("hello");
- char a2[6]("world");
- copy_array<char, 6>(a1, a2);
- std::cout << a2 << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement