Array initialization
How can i initialize the two variables wiht 0?
1 2 3 4 5 6 7
|
class student{
private:
char *nam;
float *grades
public
student(){grades=...;);
};
|
1 2
|
grades = 0.0;
nam = '0';
|
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
// class
class student
{
public:
student(void);
~student(void);
private:
int *grades;
char *name;
};
// constructor
student::student(void) : name( "undefined" ), grades( 0 ) // set values here, in the ctor
{
}
|
Topic archived. No new replies allowed.