Find the output for the following code (4)

Sir / Madam,
My question is

Find the output for the following code

#define one 0
#ifdef one 
printf("one is defined ");
#ifndef one
printf("one is not defined ");

Advance Thanks,
R.Rengaraj
{Java Certification Quiz}
{On this forum my 21st Question.}

Replies

  • sarveshgupta
    sarveshgupta
    Is the answer

    one is defined
  • rengaraj
    rengaraj
    Hi,
    Yes, you are right but 0 denotes false in C.
    If value of one , 0 is applied. Then the next printf will not be executed.
    But we get "one is defined" how ?
    R.Rengaraj
  • gaurav.bhorkar
    gaurav.bhorkar
    rengaraj
    Hi,
    Yes, you are right but 0 denotes false in C.
    If value of one , 0 is applied. Then the next printf will not be executed.
    But we get "one is defined" how ?
    R.Rengaraj
    #define one 0
    This directive defines "one".

    #ifdef one 
    printf("one is defined ");
    #ifndef one
    printf("one is not defined ");
    These directives check whether "one" is defined or not, irrespective of the value "one" takes.
  • Sahithi Pallavi
    Sahithi Pallavi
    Good answer Gaurav..!
  • gaurav.bhorkar
    gaurav.bhorkar
    sahithi pallavi
    Good answer Gaurav..!
    Thank You!
  • sarveshgupta
    sarveshgupta
    Good answer Gaurav
  • rengaraj
    rengaraj
    Thanks...
    R.Rengaraj

You are reading an archived discussion.

Related Posts

I wish to know if I can use a voltage stabiliser instead of UPS for my computer? Will it create any problems? Let me know the difference between the two.
Hello, I want to study the function of coffee machine. can help me to draw the electronic circuit of an expresso coffee machine, Which are electronic components to be used...
Google's share of the search-engine market continued to grow in November as both Yahoo's and Bing's shrank, according to numbers released Wednesday by Experian Hitwise. See the market share of...
hi all, I am a 2009 graduate in computer science and i am searching for a job. Since i have an aggregate less than 60% i found that getting a...
Finally, the highly anticipated film from director Karan Johar and starring Shahrukh Khan and Kajol, will open in theaters worldwide on Valentine’s Day weekend, that is, February 12, 2010. My...