I don't know much about malloc and I know there are similar questions but I still wanted to ask.
When I compiled my code I came across these errors
scheduler.c: In function 'char* addprocess(char*, FILE*)':
scheduler.c:127:60: error: invalid conversion from 'void*' to 'process*'
scheduler.c:135:38: error: invalid conversion from 'void*' to 'char*'
scheduler.c:170:65: error: invalid conversion from 'void*' to 'event*'
scheduler.c: In function 'int main()':
scheduler.c:381:52: error: invalid conversion from 'void*' to 'stat*'
*** Error code 1
make: Fatal error: Command failed for target `all'
127 struct process* newproc = malloc(sizeof(struct process));
135 newproc->name = malloc(line-pos-1);
170 struct event* newevent = malloc(sizeof(struct event));
381 statistics = malloc(amount* sizeof(struct stat));
The problem is that you're using a C++ compiler to compile C code.
In C, a
void * can freely be converted to or from any other non-function pointer without a cast. In C++, a cast is required, which is why you're getting errors about converting to/from
Use the C compiler to compile C code:
gcc scheduler.c -o out