Pointers, Struct, C++,Writing a new structure in a function

Could someone explain me the following mistakes and tell me how to fix them (written as comments)?

The structure I have:

const int max = 1000;
const int MAX = 30;

struct student_t
{
    int k; 
    char* name[MAX];  
    char** bez[MAX]; 
};

With this function I must write a member of this structure(members<=1000) and bez. (<=30) for every member:

int write (student_t *field[max], int i)
{
    student_t *pointerfield= new student_t;
    printf("Number:....");  
    std::cin>>pointerfield->number;
    if (pointerfield->number>1 && pointerfield->k<999999)
    {
        if (binarsearch(&field[max],i,(pointerfield->number))!=-1)
        {
            return i;
        }
        else
        {
            printf("nName:.....");
            readstr();
            pointerfield->name=readstr(); 

            // insupportable types of allocation of int to char* [30]

            std::cout<<std::endl;
            int counter=0;
            std::cout<<"Do you want to add bez.? j,n"<<std::endl;
            char a;
            std::cin>>a;

            if(a=='j' && counter<MAX)
            {
                std::cout<<"Bez.:";
                readstr();
                pointerfield->bez[MAX]=readstr();

                // char *  can not be converted into assignment to char ** 

                counter++;
            }
            // ...


Source: c++

Leave a Reply