Too few arguments error. Calling a function from within a function?

This is a discussion on Too few arguments error. Calling a function from within a function? within the C Programming forums, part of the General Programming Boards category; Code: double calc_baking_time(char bread_type, char loaf, char manual); int main() { } void instructions_white_single_manual() { printf("Primary kneading: 15 mins\n"); printf("Primary ...

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    140

    Too few arguments error. Calling a function from within a function?

    Code:
          
    double calc_baking_time(char bread_type, char loaf, char manual);
    int main()
     {
    }
     void instructions_white_single_manual()
      {
              printf("Primary kneading: 15 mins\n");
     
              printf("Primary rising: 60 mins\n");
     
              printf("Secondary kneading: 18 mins\n");
     
              printf("Secondary rising: 20 mins\n");
     
              printf("Loaf shaping: 2 seconds\n");
     
              printf("You should remove the dough for manual baking.\n");
     
              calc_baking_time(char bread_type, char loaf, char manual);
    Basically im trying to call another function from within my instructions_white_single_bake, but i keep getting "expected expression before char" error
    Last edited by tmac619619; 10-23-2012 at 03:32 PM.

  2. #2
    Registered User
    Join Date
    May 2012
    Posts
    1,066
    Here
    Code:
    double calc_baking_time(char bread_type, char loaf, char manual);
    you declare your function to take three arguments.

    Here
    Code:
    calc_baking_time();
    you call it without any arguments.

    What do you not understand when the compiler tells you that you use "too few arguments"?

    Bye, Andreas

  3. #3
    Registered User
    Join Date
    Oct 2012
    Posts
    140
    Quote Originally Posted by AndiPersti View Post
    Here
    Code:
    double calc_baking_time(char bread_type, char loaf, char manual);
    you declare your function to take three arguments.

    Here
    Code:
    calc_baking_time();
    you call it without any arguments.

    What do you not understand when the compiler tells you that you use "too few arguments"?

    Bye, Andreas
    0.0. i updated the OP. Thanks for catching my mistake

  4. #4
    Registered User
    Join Date
    Jun 2011
    Posts
    2,650
    1. Don't edit the original post like that - it makes the subsequent responses confusing.
    2. There don't seem to be any values being passed to your function - you might want to declare those as variables, define them, then pass them to the function.
    3. When you call a function, you aren't supposed to include the data types like that. Did you try compiling that code? What happened?

    Code:
    int sum(int x, int y);  // <-- function declaration/prototype
    
    int main(void)
    {
        int result;
        int a = 3;
        int b = 4;
    
        result = sum(a,b);  // <-- function call (from within "main()")
    
        return 0;
    }
    
    int sum(int x, int y)   // <-- function definition
    {
        return (x + y);
    }
    Calling a function from a function is the same as calling a function from "main()" (which is, after all, another function).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. error too few arguments to function: 'generateQuestions'
    By sunandstars in forum C Programming
    Replies: 9
    Last Post: 02-19-2011, 03:09 PM
  2. Replies: 9
    Last Post: 01-02-2007, 04:22 PM
  3. function calling within another function error
    By bazzano in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 01:40 AM
  4. error in calling a function
    By arian in forum C++ Programming
    Replies: 3
    Last Post: 12-24-2003, 02:42 AM
  5. error calling function
    By simhap in forum C++ Programming
    Replies: 3
    Last Post: 11-29-2001, 07:58 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21