Thread: Simple program that wont execute

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    You are trying to pass the address of the variable mileage:

    Code:
    printf("The miles per gallon for this tank was " , &mileage);
    That is not what you want. Pass the variable as an argument, without the & operator. Also, you will want to have a format specifier in the call to printf(), which you did not supply.

    Code:
    printf("The miles per gallon for this tank was %d" , mileage);

  2. #2
    Registered User
    Join Date
    May 2004
    Posts
    68
    [QUOTE=kermit]You are trying to pass the address of the variable mileage:

    Code:
    printf("The miles per gallon for this tank was " , &mileage);
    That is not what you want. Pass the variable as an argument, without the & operator. Also, you will want to have a format specifier in the call to printf(), which you did not supply.

    Code:
    printf("The miles per gallon for this tank was %d" , mileage);
    Strange I'm still not getting that last line to printout
    Last edited by Extropian; 07-21-2005 at 06:55 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [Help] Simple Array/Pointer Program
    By sandwater in forum C Programming
    Replies: 3
    Last Post: 03-30-2007, 02:42 PM
  2. simple silly program
    By verbity in forum C Programming
    Replies: 5
    Last Post: 12-19-2006, 06:06 PM
  3. Simple window program
    By baniakjr in forum C++ Programming
    Replies: 5
    Last Post: 03-11-2006, 03:46 PM
  4. Help with simple program
    By nik2007 in forum C++ Programming
    Replies: 4
    Last Post: 02-27-2006, 09:54 AM
  5. Need help on code to execute the program
    By hibmem10 in forum C++ Programming
    Replies: 6
    Last Post: 12-24-2005, 01:42 PM