Thread: Unable to get output..........

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    45

    Unable to get output..........

    Code:
    main()
    {
     int i=3;
     printf("value of i=%d",i);
     printf("address of i=%u",&i);
     printf("value of i=%d",*(&i));
    }
    C enlightened

  2. #2
    Registered User
    Join Date
    Sep 2012
    Posts
    45
    There are no error messages,I just cannot see the output screen.
    C enlightened

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    stdout is buffered and will display when it reaches a newline or is flushed.

    gg

  4. #4
    Registered User
    Join Date
    Sep 2012
    Posts
    45
    Hello codeplug,can you explain what is stdout?Is it a pre processor directive like stdio?
    C enlightened

  5. #5
    Registered User
    Join Date
    Sep 2012
    Posts
    45
    Thanks,got the output,just had to use a pre-processor directive.
    C enlightened

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    >> can you explain what is stdout?
    "stdout" is the stream that printf() prints to.

    gg

  7. #7
    Registered User
    Join Date
    Nov 2011
    Posts
    161
    Quote Originally Posted by sameertelkar View Post
    Thanks,got the output,just had to use a pre-processor directive.
    The only preprocessor directive needed is #include <stdio.h>

    If you do this you will get an output:

    Code:
    #include <stdio.h>
    
    
    main()
    {
         int i=3;
         printf("value of i=%d",i);
         printf("address of i=%u",&i);
         printf("value of i=%d\n",*(&i));
    return;
    }
    
    

  8. #8
    Registered User
    Join Date
    Jun 2013
    Posts
    66
    As long as we are making improvements to the code, we may as well fix everything:
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    int main(void)
        {
        int i = 3;
    
        printf("value of i = %d\n", i);
        printf("address of i = %p\n", (void*)&i);
        printf("value at %p = %d\n", (void*)&i, *(&i));
    
        return EXIT_SUCCESS;
        }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 25
    Last Post: 12-27-2012, 11:19 PM
  2. Unable to print the output of a conversion problem
    By abhishekcoder in forum C Programming
    Replies: 1
    Last Post: 04-13-2012, 11:16 AM
  3. Seem unable to use EOF?
    By black_stallion in forum C Programming
    Replies: 18
    Last Post: 01-02-2012, 08:23 PM
  4. unable to remember
    By Pulock2009 in forum C Programming
    Replies: 6
    Last Post: 05-08-2010, 11:57 AM
  5. Unable to use string
    By Suchy in forum C++ Programming
    Replies: 9
    Last Post: 09-26-2006, 01:24 PM