Tutorials‎ > ‎

C Aptitude Questions

Recent C Aptitude Posts

  • C Aptitude Question : Macro C Aptitue Question : MacroQuestionWhat is the output of the program?#defineABC     20#define XYZ    10#define XXX    ABC - XYZvoid main(){        int     a;        a = XXX * 10;        printf("%d ...
    Posted Nov 1, 2009, 10:08 AM by Thiyagaraaj M
Showing posts 1 - 1 of 1. View more »

C Aptitude Question : Macro

posted Oct 5, 2009, 11:38 AM by Thiyagaraaj M   [ updated Nov 1, 2009, 10:08 AM ]


C Aptitue Question : Macro

Question
What is the output of the program?

#defineABC     20

#define XYZ    10
#define XXX    ABC - XYZ
void main()
{
        int     a;
        a = XXX * 10;
        printf("%d\n", a);
}

Solution:
a = xxx * 10
which is => a = ABC - XYZ * 10
         => a = 20 - 10 * 10
         => a = 20 - 100
         => a = -80

1-1 of 1