Error: Does not name a type
class subject {
public:
  char subjectname[];
  char classroom[];

};


This creates a class subject which has two char arrays of unspecified size as its members. This will attempt to create an array of size 0 (see here). This is not what you want. You can e.g. statically allocate the space with a maximum number of characters beforehand and then strncpy() your new string inside the buffer.

This would look like 

class subject {
public:
  char subjectname[32];  //32 bytes buffer
  char classroom[32];
};


And later 

subject math;
strncpy(math.classroom, "A1", 31); //copy at max 31 bytes to not overwrite the NUL terminator
Serial.print("Classroom is: ");
Serial.println(math.classroom)


Or, just use the Arduino String class.  For example  

#include &lt;Arduino.h&gt;
class subject {
public:
  String subjectname;
  String classroom;
};


Then your first usage code can be used unmodified.

Example

#include &lt;Arduino.h&gt;

class subject {
public:
  String subjectname;
  String classroom;
};

void setup() {
    Serial.begin(115200);

    subject math;
    math.classroom = "A1";

    Serial.print("Classroom is: ");
    Serial.println(math.classroom);
}

void loop() { }