Thread: Scanf Being skipped

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    7

    Scanf Being skipped

    I have the following code:

    Code:
    #include <stdio.h>
    #include <string.h>
    
    
    int main(void)
    {
    	long Accounts[25];
    
    		scanf("%8l",&Accounts[0]);
    		scanf("%8l",&Accounts[1]);
    
    	return 0;
    }
    The first scanf works but it is skipping over the second scanf. It will not ask for a second input. What is the problem?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    if you type more than 8 characters at the first prompt, the excess will be applied to future scanf calls.

  3. #3
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Look here

    Use %ld not %l

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Scanf() skipped
    By new-b in forum C Programming
    Replies: 9
    Last Post: 07-18-2009, 01:34 AM
  2. scanf is being skipped
    By yougene in forum C Programming
    Replies: 6
    Last Post: 12-24-2008, 06:05 AM
  3. Second scanf keeps getting skipped.
    By yougene in forum C Programming
    Replies: 9
    Last Post: 12-23-2008, 02:39 AM
  4. Help with a basic scanf procedure.
    By killpoppop in forum C Programming
    Replies: 9
    Last Post: 11-03-2008, 04:39 PM
  5. scanf - data is "put back" - screws up next scanf
    By voltson in forum C Programming
    Replies: 10
    Last Post: 10-14-2002, 04:34 AM