This is the case. Teacher asked the task. In which it is necessary - to allocate memory for the elements of the array and then free up memory. Made a task.
typedef struct { int Id; char FIO[NAME_SIZE]; int Mark; char Teacher[NAME_SIZE]; }Student; Student students[100];
I think that the last line I allocate memory for 100 items. But! I began to read about the sequence, found some:
Init is the initial memory allocation for the sequence elements;
And here is the question. Even two. Do I need to do a memory allocation through init (the teacher is on vacation, so it's too late to rush around, if doing it right through init means you have to do it)? And the second is where to read about it. Slightly google operation init, about it except in my training manual - there is nothing. Help plz!
Refinement describes the Init function:
int Init(SEQ* seq, int MaxSize) { if (seq->pArr != NULL) return -1; seq->pArr = (int*) malloc(MaxSize*sizeof(int)); if (seq->pArr == NULL) return -2; seq->nMaxSize = MaxSize; seq->nSize = 0; return MaxSize; }