Continuing with sahta's suggestions, I'd like to elaborate on "recommended" style for your malloc calls:

Compare this:


parameters=(struct parameters*)malloc(sizeof(*parameters));


With...