我有以下代码:
#define NUM_STUDENTS 20
#define TIME_STUDENTS 10
typedef struct
{
int name;
int age;
} Student;
typedef struct
{
int number;
int post;
} Contact;
typedef struct
{
int number;
Student students[TIME_STUDENTS][NUM_STUDENTS];
Contact contact[NUM_STUDENTS];
} Master;
typedef struct
{
int number;
Student students[NUM_STUDENTS][NUM_STUDENTS];
Contact contact[NUM_STUDENTS];
} Info;
Info info;
Master master;
//fill the data for master
if(NUM_STUDENTS < 10)
{
memcpy(&info.student[0][0],
&master.student[0][0],
sizeof(Student) * NUM_STUDENTS * NUM_STUDENTS);
}
NUM_STUDENT
S 可以从修改1
为20
。但我收到以下警告:
Warning 420: Apparent access beyond array for function 'memcpy(void *, const void *, unsigned int)', argument 3 exceeds argument 2
有什么问题以及如何解决?