Thread: Number Convert function

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,666
    Code:
    $ gcc -Wall foo.c
    foo.c: In function ‘main’:
    foo.c:9:9: warning: format ‘%d’ expects a matching ‘int *’ argument [-Wformat=]
        9 | scanf("%d,&digit");
          |        ~^
          |         |
          |         int *
    $
    Do you see what's wrong here?
    Code:
    scanf("%d,&digit");
    Compare with
    Code:
    scanf("%d",&digit);
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  2. #2
    Registered User
    Join Date
    Apr 2019
    Posts
    35
    I am really sorry how that mistake happened. I will try with the changes.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Convert a binary number into a decimal number
    By HTHVampire in forum C++ Programming
    Replies: 7
    Last Post: 07-06-2013, 09:53 AM
  2. Convert 8-digit Binary Number to decimal number
    By yongsheng94 in forum C++ Programming
    Replies: 2
    Last Post: 07-06-2013, 09:47 AM
  3. Shorter way to convert number to txt
    By someone_stupid in forum C Programming
    Replies: 6
    Last Post: 11-01-2009, 10:52 AM
  4. Replies: 6
    Last Post: 07-15-2008, 02:27 PM
  5. How can i convert negative number to positive number ?
    By winsonlee in forum C Programming
    Replies: 2
    Last Post: 05-05-2004, 08:02 AM

Tags for this Thread