Thursday, January 27, 2011

Output..?


#include<stdio.h>  
#include<conio.h>
void main()
{
enum c{c·34, d-12, a, b};
clrscr():
if(a== (1==2))
printf("%d", a);
else
printf("%d" , b) ;
}

7 comments:

  1. yeh enum main aise values daal sakte hain??

    ReplyDelete
  2. Hey are you sure there is no typing mistake in it???

    ReplyDelete
  3. #include
    #include
    void main()
    {
    enum c{c=34, d=12, a, b};
    clrscr():
    if(a== (1==2))
    printf("%d", a);
    else
    printf("%d" , b) ;
    }

    ReplyDelete
  4. in the statement 'if(a== (1==2))'
    as far as i know (1==2) will result in to 'false'.
    and it'll check if(a==false)
    but 'a' is not of boolean data type.
    so how this is going to be interpreted??

    ReplyDelete
  5. Output 14
    Explanation: Here tagname (c) and constant name (c) is same
    but still no errors. The values for constant names,
    c=34
    d=12
    a=13
    b=14
    if(a==(1==2)) this is FALSE because,
    if (a==(0)) —> (because 1==2 is not TRUE)
    if (13==0) —> FALSE Hence b's value is printed

    ReplyDelete