像这样吗?还有没有别的更好的方法
#include <stdio.h>
#include <stdlib.h>
typedef struct _user{
int total_score;
int pefect_score;
int scores[];
}User;
int main()
{
int user_num, problem_num;
scanf("%d %d", &user_num, &problem_num);
User* users = (User*)malloc(user_num * (sizeof(User) + problem_num*sizeof(int)));
return 0;
}
1
MCVector 2015-10-21 09:22:22 +08:00
如果是 C++ 的话,我会在 struct 里 加 con/destructor. C 的话我想能不能在外面实现一个 con/desstructor.
|