Seems fairly self explanatory. The first error is "error: too many arguments to function",
the call is insert_ingredient_order(tree1, name, quantity, type) (i.e. 4 arguments)
the function called is insert_ingredient_order(Ingredient *tree, char *new_name,int quantity) (i.e. 3 arguments).

Is the problem then that you don't understand what "too many arguments to function" means?

The while loop is otherwise a bit bizarre. Do you really mean to call insert_ingredient_order() twice for each iteration? What if the one in the braces returns NULL but the one in the while test doesn't?

Check order of precedence. A = B != C means assign to A the boolean value that is the result of the comparison of B not-equal-to C, or using brackets to show the order of precedence: A = (B != C). This is why you get the warning "warning: converting to non-pointer type `bool' from NULL" -- it's a warning because the code isn't necessarily wrong; you can compare something and assign the result to something else. What you might mean is ((A=B)!=C), i.e. assign THEN compare with NULL.

I'm not sure that =! means the same as !=; it might mean "assign the logical inverse" rather than "not equals". Use the common ordering for clarity, i.e. if =! == !=, use !=. Similarly if <>==><, use <>. Be a smart alec when you're smart, not before.

The error about nsert_ingredient_order should be obvious, but if "too many arguments" isn't obvious..... Count the i's.

The braces don't match in rinsert_ingredient_order(), that's why you get "error: a function-definition is not allowed here before '{' token". Always line up braces while you're learning; you can start to put them in silly places such as on the same line as the test once you stop making mistakes like this.
With lining up not only is the missing closing brace obvious but you probably wouldn't have made that mistake in the first place:
}  // Start a new function on a new line, i.e. ...

Recipe *rinsert(...) // ... HERE, not on the same line as the closing 
brace of the previous function
{ // Place the opening brace of rinsert HERE, not on the line above.
  Ing *t=0;
  if (rtree==NULL)
  { // Brace goes HERE, not on the line above
    while (stuff!=NULL)
    { // Brace goes HERE, not on the line above
      stuff; // strange, to duplicate the stuff in the while test AND
 in the loop.
    } Closing brace for the while
    return DANGER WILL ROBINSON.  Because we're indenting correctly 
and know the final return should be 2 spaces in rather than 4, it should
be immediately obvious that we're in the wrong place.
  } // This is what you think is the closing brace of the function, but 
proper indentation shows clearly that it isn't.

void print()  // You can't have nested functions.  Because rinsert 
isn't complete this function is being declared INSIDE 
function rinsert().
  // etc.

Last edited by xpi0t0s; 21Sep2008 at 00:14.. Reason: splitting long lines