#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    15
    Rep Power
    0

    Solve the logical expression


    #include<stdio.h>
    int main()
    { int a=0,b=1,c=3;
    *((a)?&b:&a)=a?b:c;
    printf("%d%d%d\n",a,b,c);
    return 0;
    }



    i am getting the output as
    313
    how is this logical expression solved ?
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Location
    India
    Posts
    95
    Rep Power
    4
    other way to write same expression using if else.

    Code:
    if(a)
    {
    *(&b)=a?b:c; // same as b= a?b:c
    }
    else
    {
    *(&a)=a?b:c;//same as a=a?b:c
    }
    hope u know about a?b:c
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    15
    Rep Power
    0
    got it ..thanks

IMN logo majestic logo threadwatch logo seochat tools logo