T
terminator
#include<iostream>
using namespace std;
class cpchk{
private:
char* name;
int num;
public:
// Methods for name
char* getname()const{
cout<<"Address:Name>>"<<&name<<endl;
****wait a minute****.try this:
cout<<"name string
adress>>"<<( (void*)name )<<endl;
remmember that 'name' is a pointer to 'char's who stores the address
of a 'char' ,but meanwhile it is a variable and every variable has an
address which is indepent from its value and is retrived via the unary
'&' operator.
and why do you prefer malloc/free over new/delete?
try this:name=(char*)malloc((strlen(acname)+1)*sizeof(char));
name= new char[strlen(acname)+1];//much simpler
instead do this:free(name);
delete name;//invokes destructor prior to remove from heap
regards,
FM