Thread: Need help with compiler configutration.

  1. #1
    Registered User
    Join Date
    Nov 2013
    Location
    Curitiba, Brazil, Brazil
    Posts
    16

    Need help with compiler configutration.

    Hi guys, I used codeblocks to create this simple program in order to test scanf and printf.
    The problem is when I type any input.
    2 for example.
    The outputs is always 2686748.
    Code:
    int main()
    {
        int h;
        scanf("%d", &h);
        printf("%d",&h);
        return 0;
    }

  2. #2
    Registered User migf1's Avatar
    Join Date
    May 2013
    Location
    Athens, Greece
    Posts
    385
    Try printf("%d", h); instead, in line 5 (with & you're getting the address of h).

  3. #3
    Registered User
    Join Date
    Nov 2013
    Location
    Curitiba, Brazil, Brazil
    Posts
    16
    Newbie detected hehe.
    Thank you a lot, I was 2 days trying to fix this.

  4. #4
    Registered User migf1's Avatar
    Join Date
    May 2013
    Location
    Athens, Greece
    Posts
    385
    You are welcome

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 04-23-2012, 07:54 AM
  2. Replies: 7
    Last Post: 12-13-2010, 10:02 PM
  3. Replies: 4
    Last Post: 09-12-2009, 01:10 PM
  4. Replies: 2
    Last Post: 02-04-2008, 02:34 AM
  5. hp iPAQ 6300 && C compiler || C# compiler
    By xddxogm3 in forum Tech Board
    Replies: 2
    Last Post: 12-07-2004, 07:28 AM