vendredi 3 juin 2022

Error E0146 : Too many initializer values C++

I have a school project and I have to use the AM in the Student.h as a char*.The AM have to have numbers in it. I can't understand why what I am doing is not working. Student.cpp

#include <iostream>
#include <string>
#include "Student.h"
using namespace std;
int main()
{
    Student dlg;
    dlg.AM[10]={2,1,3,9,0,2,6,6};
    
}

Student.h

#pragma once
#include <string>

using namespace std;

class Student
{
public:
    char *AM[20];
    string Name;
    unsigned int Semester = 1;
};

Aucun commentaire:

Enregistrer un commentaire