Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
strcpy
#include <iostream> #include <cstdio> #include <cstring> using namespace std; class Test{ public: char* name; Test():name(new char[10]){} void set(char* value){ /*int i=0; while(*value != 0){ *(name+i) = *(value++); ++i; } *(name+i) = 0;*/ strcpy(name,value); } }; int main(){ char in[10]; Test* data[3]; for(int i=0;i<3;++i){ scanf("%s",in);//input: A B C data[i] = new Test(); data[i]->set(in); } for(int i=0;i<3;++i){ cout<< data[i]->name<<endl;//output: A B C } return 0; }
run
|
edit
|
history
|
help
0
Dar
g++ -Wall *.cpp -o aco; ./aco.
Elevator 3
is_sorted_30-Seconds-of-C++
multi bitmap
1163. Last Substring in Lexicographical Order
TREE - path from root to leaf with given sum
Policy based smart pointer
ConversionOperator
mur1