[Solved] How to fix ‘constructor is invalid use’ in C++?
Student is not a function that can be called on a Student* pointer. To construct an object call new Student. stu[i] = new Student(Name, id, age, cpp_score, cpp_count); Or even better: don’t use raw pointers, use a std::vector<Student>. Compare the CppCoreGuidelines for that. solved How to fix ‘constructor is invalid use’ in C++?