I need to create a struct which contains 1 int, 2 char, 1 float and (I write the lines from the exercise): "two pointers on functions for reading data void (read*)(student*st) and one pointer for displaying data void (write*)(student*st) "
I just don't understand the sentence. I know the syntax for a pointer to function in C. I don't get what read* and write* are. If it was *read and *write then in would be the pointer variable name to a function and (student*st) is the parameter, a pointer to struct.
Also, in the exercise appear that the program is about ANSI C but also it asks me to use cin to read the number of students and to allocate memory using new for an array of students.
This is how I started.
struct student {
int idNumber;
char name[100];
char gender[20];
float mark;
??
};
read*andwrite*are" - I'm afraid this is invalid syntax. The pointers should look likevoid (*read)(student*). - ForceBruvoid (read*)(student*st)seems like a typo as you said. It should bevoid (*read)(student*st). And being asked to usecinin C code doesn't make sense. Ask your instructor. - Kevinvoid (read*)(student*st), it has a bug. Thats not legal C syntax. As you actually more or less write in the question, the correct syntax isvoid (*read)(student*st)- 4386427