As a matter of coding technique, when initializing data members of a class or struct within a constructor, it is always better to use an initializer list. In your case:
1 2 3 4 5 6 7 8 9 10
class student {
char name[4];
int rno;
public:
student() : rno( 1 ) // Note initializer
{
// This one can't be in the initializer list. Could be if name was a std::string instead
strncpy( name, sizeof( name ), "abc" );
}