Thread: error message: too few arguments for format

  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    2

    error message: too few arguments for format

    Hi, everyone.
    I am a C programming learner. I wrote a little program but I get an error message when I try to compile it with gcc compiler.
    This is my little program:
    Code:
    #include <stdio.h>
    
    int main()
    {
    int answer;
    printf ("Welcome to the English language quiz!\nPlease answer the next question:\nWhat is the colour of the Lemon?\n1)Red\n2)Orange\n3)Yellow\nPlease type in the number of the right answer and press Enter:");
    
    scanf ("%d, &answer");
    
    if (answer == 3)
    {
    printf ("Congratulations! Your answer is right.");
    }
    else
    {
    printf ("Sorry. The right answer is 3)Yellow.");
    }
    
    return 0;
    }
    Error message:
    Code:
    liviu@liviu-pc ~/Desktop $ gcc welcome\ to\ c\ programming.c 
    welcome to c programming.c: In function ‘main’:
    welcome to c programming.c:8:1: warning: too few arguments for format
    Can somebody explain to me what is wrong?
    Thank you.

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Wrong
    Code:
    scanf ("%d, &answer");
    Might be right
    Code:
    scanf ("%d", &answer);
    Tim S.

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    2
    Wow. Thank you for your quick reply. I can go on now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 13
    Last Post: 10-08-2010, 05:35 PM
  2. Error converting to same format?
    By FlyingIsFun1217 in forum C++ Programming
    Replies: 19
    Last Post: 07-07-2010, 12:39 PM
  3. error in oengl pixel format.
    By Darkinyuasha1 in forum Windows Programming
    Replies: 1
    Last Post: 01-22-2007, 07:06 PM
  4. DNS message format
    By Yasir_Malik in forum Networking/Device Communication
    Replies: 10
    Last Post: 02-17-2005, 07:16 AM
  5. Data Format Error Detection.
    By Ti22 in forum C Programming
    Replies: 2
    Last Post: 01-03-2004, 11:52 AM