Try this:
#include <iostream>
class student
{
private:
int rollno;
char name[20];
int marks;
public:
student(int _rollno, const char* _name, int _marks)
{
memset(name, 0, 19);
rollno = _rollno;
strcpy_s(name, _name);
marks = _marks;
}
student(student &s)
{
rollno = s.rollno;
strcpy_s(name, s.name);
marks = s.marks;
}
void display()
{
std::cout << rollno << ", " << name << ", " << marks;
}
};
void main()
{
const char *str = "hka\0";
student stud1(23, str, 100);
student stud2(stud1);
stud2.display();
}