Weird printf() problem

This is a discussion on Weird printf() problem within the C++ Programming forums, part of the General Programming Boards category; I have the following code below that I think is causing problems: Code: #include <stdio.h> #include "rt.h" int main() { ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    222

    Weird printf() problem

    I have the following code below that I think is causing problems:

    Code:
    #include <stdio.h>
    #include "rt.h"
    
    int main()
    {
           // Some code irrelevant to the problem       
    
           int send_c = 3;
    
           // More code irrelevant to the problem
    
           printf("Hit RETURN to Write the integer %d to the pipeline.....\n", &send_c) ;
    
           // More code irrelevant to the problem
    
           return 0;
    }
    However, the MS-DOS command prompt outputs "1244988" rather than 3. Does anyone have a suggestion of possibly why it's doing so?

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    How about you print the value of the integer instead of its address?

    BTW, this is C code, not truly C++.
    Last edited by MacGyver; 02-23-2008 at 02:26 AM.

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    222
    Thanks for the help. Solved my problem.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with a C Programing Quiz project
    By dilemma in forum C Programming
    Replies: 12
    Last Post: 05-15-2009, 04:35 PM
  2. IF CONDITION plese help
    By birumut in forum C Programming
    Replies: 12
    Last Post: 03-06-2009, 09:48 PM
  3. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  4. printf output makes no sense. Is it a Pointer problem?
    By officedog in forum C Programming
    Replies: 3
    Last Post: 10-03-2008, 10:01 AM
  5. very weird problem (pointers I think)
    By hannibar in forum C Programming
    Replies: 2
    Last Post: 10-11-2005, 07:45 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21