Thread: how here j is printing 7.give the explanation

  1. #1
    Registered User
    Join Date
    Aug 2010

    how here j is printing 7.give the explanation

    int i = 3,j;
    j = add(++i);
    printf("i = %d j = %d\n", i, j);
    int ii;
    printf("ii = %d\n", ii);

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    No cookie for you until you tell us where you got this from and why you want to know the answer when you have not made any effort to figure it out yourself.

    If you are getting this from some book, then throw the book away (or return it to the library). If you are getting this from some website, then close any browser windows/tabs that has that website opened, remove it from your bookmarks, and clear your history and cache. Then forget about that website. If you wrote the program yourself... you need to unlearn what you have learned.
    Last edited by laserlight; 09-03-2010 at 05:15 AM.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Aug 2010
    i suggest that if you are using a book/Internet, take a paper and write down the code...then slowly line after line you should be able to understand is boring...but it is a method!

  4. #4
    C lover
    Join Date
    Oct 2007
    THAT code is old!

    add(ii)int ii;

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    what is the program output please explain
    Continuing with the homework dump and 0% effort I see.

    Soon, I will lock them on sight.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C# Printing Problem
    By silverlight001 in forum C# Programming
    Replies: 0
    Last Post: 03-23-2009, 01:13 AM
  2. Printing Lines to .txt File
    By Programmer3922 in forum C Programming
    Replies: 2
    Last Post: 08-02-2008, 12:45 PM
  3. generic printing preferences dialog box
    By stanlvw in forum Windows Programming
    Replies: 8
    Last Post: 06-27-2008, 02:20 AM
  4. printing data to a file
    By coralreef in forum C Programming
    Replies: 3
    Last Post: 11-02-2006, 08:10 PM
  5. need help relating printing?
    By omarlodhi in forum Linux Programming
    Replies: 0
    Last Post: 03-03-2006, 04:46 AM