There's no such thing as an array type argument. That argument that you've declared char nazwisko[40]
is actually transformed into a pointer type char* nazwisko
. So now you can see that you're trying to assign a pointer to an array. Of course that won't work.
In fact, you cannot simply assign arrays to each other at all. You must copy the elements across if you need to. You could use the C function strcpy
to do that, which will take into account that the argument should be a C-style string. If you want to copy the full array, then you might like to use std::copy
.
If you are indeed working with strings of text, you're much better off using the standard std::string
type to do this. They are much easier to pass around and assign than arrays of char
:
std::string nazwisko;
std::string imie;
// ...
Student(int nr_ID, std::string nazwisko, std::string imie, double punkty){
this->nazwisko = nazwisko;
this->imie = imie;
// ...
}
In fact, you can save yourself the pain of default initializing those member variables and then just assigning to them by using the constructor member initialization list:
Student(int nr_ID, std::string nazwisko, std::string imie, double punkty)
: nr_ID(nr_ID), nazwisko(nazwisko), imie(imie), punkty(punkty), next(NULL)
{ }