我有以下方法内容:
FILE *file;
file = fopen("customers.dat", "w");
PList *list;
list = &customers;
fprintf(file, "%s", *(list->person.name));
在fprintf行上给出错误::
format '%s' expects argument of type 'char *', but argument 3 has type 'int' [-Wformat]
我有以下结构:
plist中:
typedef struct PList{
Person person;
struct PList *nextPerson; // set to NULL by default <<<<<
}PList;
人:
typedef struct Person{
char name[100]; // Left as "" if empty Person
PersonID ID;
float amountOwed;
}Person;
是PersonID:
typedef struct PersonID{
char letter;
int number; // 7 digits
}PersonID;
答案 0 :(得分:6)
放弃*
:
fprintf(file, "%s", *(list->person.name));
^