[ create a new paste ] login | about

Link: http://codepad.org/zuWYIjAE    [ raw code | output | fork ]

C++, pasted on Jan 18:
#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;
    }


Output:
1
2
3
4
one: hello
two: 
one: hello
two: hello


Create a new paste based on this one


Comments: