Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
char pointer in class
#include <iostream> using namespace std; class Test{ public: char* name; Test(char* n):name(n){} }; int main(){ char in[10]; Test* data[3]; for(int i=0;i<3;++i){ cin>>in;//input: A B C data[i] = new Test(in); } for(int i=0;i<3;++i){ cout<< data[i]->name<<endl;//output: C C C } return 0; } // why???
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Network UVa
Filtering a vector attribute with template UnaryPredicate
prototype match
horse aand goat working
Widget Class with dynamic memory and pointers
Rotate array
temp
Function to m_function
congruence modulo equations (together with a simple BigInteger class)
Beadandó
stackse - search stackoverflow differently
Please log in to post a comment.