Thread: Code issue scanf() string line 28

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jan 2020
    Posts
    6
    Quote Originally Posted by laserlight View Post
    You mentioned string input, but it looks like you intended integer input.
    When I past the code it seems it added extra lines. The issue seems to be here.

    Code:
    printf("\n Title name: ");
                scanf("%s", &books[i].title);
    Also, the code doesn't perform anything else after getting the input.

    EDITED:

    Ok, so after a needed break from being hours looking at this I understood the difference between having & and not having it when getting a string input. I took it out from the example above. But the program now crashes.
    Last edited by JazzDev; 01-28-2020 at 04:35 AM. Reason: code edited

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. scanf issue
    By cooper1200 in forum C Programming
    Replies: 16
    Last Post: 04-16-2019, 04:18 AM
  2. Multiple printf/scanf code issue
    By kumczak in forum C Programming
    Replies: 2
    Last Post: 04-08-2014, 08:33 AM
  3. N00b @ C: Code is failing at line 12 which is a basic scanf
    By Mike Garber in forum C Programming
    Replies: 3
    Last Post: 09-01-2013, 10:25 AM
  4. 'cin' and 'scanf()' issue
    By Brain Cell in forum C++ Programming
    Replies: 4
    Last Post: 11-07-2004, 10:53 AM
  5. scanf issue
    By fkheng in forum C Programming
    Replies: 6
    Last Post: 06-20-2003, 07:28 AM

Tags for this Thread