codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include <iostream> #include <string> #include <stdio.h> #include <stdlib.h> using namespace std; template <class T1, class T2> void copyStuff(const T1 source[], T2 destination[] , int size){ for (int i=0 ; i < size ; ++i){ destination[i]=static_cast<T1>(source[i]); } } int main() { const char one[] = "hello"; char two[6]={0}; cout << "one: " << one << endl; cout << "two: " << two << endl; copyStuff(one, two, 6); cout << "one: " << one << endl; cout << "two: " << two << endl; return 0; }
Private
[
?
]
Run code
Submit