Page 2 of 2 FirstFirst 12
Results 21 to 29 of 29

Thread: What is a output?. How will Come?.

  1. #21

    Re: What is a output?. How will Come?.

    0 0 1 2 -1


  2. #22

    Re: What is a output?. How will Come?.

    Quote Originally Posted by Golda View Post
    main()
    {
    int i=5;
    printf("%d%d%d%d%d",i++, i--, ++i, --i,i);
    }
    I got the output 45545. How it will come?...
    the output is 5 6 6 5 5


  3. #23
    Junior Member
    Join Date
    Jan 2007
    Answers
    7

    Re: What is a output?. How will Come?.

    0,0,1,3,0
    is this correct


  4. #24
    Junior Member
    Join Date
    Jul 2009
    Answers
    5

    Re: What is a output?. How will Come?.

    the output will be 00131
    All the effect will be occur at next statement because of post increment
    the || operator is the last element and the value of l is 2 so that any value of the previous generation will be ommited and the value of m will be true i.e. 1
    m=0||1 is 1
    i=-1 --> 0
    j=-1 --> 0
    k=0 --> 1
    l=2 --> 3
    m = 1


  5. #25
    Junior Member
    Join Date
    Aug 2009
    Answers
    4

    Re: What is a output?. How will Come?.

    Quote Originally Posted by kharade Sagar M View Post
    the output is 5 6 6 5 5
    The output for this expression is ambiguous. The ANSI C standard does not define the order of evaluation of arguments to a function. Hence, the output may vary depending on the compiler you use.


  6. #26
    Junior Member
    Join Date
    Aug 2009
    Answers
    4

    Re: What is a output?. How will Come?.

    Quote Originally Posted by Golda View Post
    what about this?
    void main()
    {
    unsigned giveit=-1;
    int gotit;
    printf("%u ",++giveit);
    printf("%u ",gotit=-giveit);
    }
    "giveit" has a bit pattern
    Code:
    11111111 11111111 11111111 11111111
    Incrementing it by 1 gives you the following bit pattern
    Code:
    1 00000000 00000000 00000000 00000000
    This 1 results from overflow, and is ignored. So, you effectively get a zero value on return


  7. #27
    Junior Member
    Join Date
    Sep 2009
    Answers
    1

    Re: What is a output?. How will Come?.

    Quote Originally Posted by Golda View Post
    main()
    {
    int i=-1,j=-1,k=0,l=2,m;
    m=i++&&j++&&k++||l++;
    printf("%d %d %d %d %d",i,j,k,l,m);
    }
    Output : 0 0 1 3 1
    EXP : As the expression have 3 && operators at the begin it will check for all the case s ,& will get 0 as resultant wch is || with 1 (i.e.,2) So that m=0||1=1.


  8. #28
    Junior Member
    Join Date
    May 2009
    Answers
    1

    Re: What is a output?. How will Come?.

    i=0,j=0,k=1,l=3,m=0


  9. #29

    Re: What is a output?. How will Come?.

    Quote Originally Posted by Golda View Post
    what about this?
    void main()
    {
    unsigned giveit=-1;
    int gotit;
    printf("%u ",++giveit);
    printf("%u ",gotit=-giveit);
    }
    ++giveit=2 n -gotit= -2


Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact