#define d 10+10
main()
{
printf("%d",d*d);
}

Answers were Sorted based on User's Feedback



#define d 10+10 main() { printf("%d",d*d); }..

Answer / raj

ans.

d*d will be replaced by 10+10*10+10

during runtime.

so answer is 10+100+10 = 120

Is This Answer Correct ?    88 Yes 0 No

#define d 10+10 main() { printf("%d",d*d); }..

Answer / hussain reddy

120

Is This Answer Correct ?    8 Yes 2 No

#define d 10+10 main() { printf("%d",d*d); }..

Answer / vrushali

This boils down to (10 +10 * 10 + 10)

so answer is 120 ... but if the same macro was rewritten as
#define d (10 + 10)

then d * d = (10 + 10 ) * (10 + 10)
= 20 * 20
= 400....

Pure macro concept....

Is This Answer Correct ?    15 Yes 12 No

#define d 10+10 main() { printf("%d",d*d); }..

Answer / jyothikrishna

Ex:1
#define A 10+10
void main()
{
int a;
a = A*A;
cout<<a<<endl;
}

Ans : 120

Explanation:
When you compile this program. A*A will be converted into 10+10*10+10. Here it follows BODMAS rule first it will perform multiplication and next it will perform addition.

First 10+10*10+10 = 10 + 100 + 10
next 10 + 100 + 10 = 120 (Answer)

Ex:2
#define A (10+10)
void main()
{
int a;
a = A*A;
cout<<a<<endl;
}

Ans : 400

Explanation:
When you compile this program. A*A will be converted into (10+10)*(10+10). Here it follows BODMAS rule first it will perform Bracket values and next it will perform multiplication.

First (10+10)*(10+10) = 20 * 20
next 20 * 20 = 400 (Answer)

Is This Answer Correct ?    2 Yes 1 No

#define d 10+10 main() { printf("%d",d*d); }..

Answer / mangal bhaldare

the value of d is 10+10
so the result is
(10+10)*(10+10)
=120

Is This Answer Correct ?    4 Yes 4 No

#define d 10+10 main() { printf("%d",d*d); }..

Answer / kumaran

400

Is This Answer Correct ?    3 Yes 46 No

Post New Answer

More C Interview Questions

#include<stdio.h> main() { int i=5; printf("%d",i*i-- - --i*i*i++ + ++i); } tell the answer with correct reason .specially reason is important nt answer ans by turbo c is -39

1 Answers   GameLoft,


Why malloc is faster than calloc?

0 Answers  


what is inline function?

2 Answers  


Given an array of length N containing integers between 1 and N, determine if it contains any duplicates.

3 Answers   SilverKey,


Explain the difference between #include "..." And #include <...> In c?

0 Answers  






difference between semaphores and mutex?

1 Answers  


what is c programming?

3 Answers   TCS,


How the C program can be compiled?

11 Answers   HP,


Which of the Following will define a type NODE that is a node in a Linked list? A)struct node {NODE*next;int x;};type def struct node NODE; B)typedef struct NODE {struct NODE *next;int x;}; C)typedef struct NODE {NODE *next;int x;}; D)typedef struct {NODE *next;int x;}NODE;

5 Answers   Accenture, TCS,


What is f'n in math?

0 Answers  


what is ram?

3 Answers   TCS,


what is the output of the following program? main() { int c[]={2,8,3,4,4,6,7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf("%d",*c); ++q; } for(j=0;j<5;j++) { printf("%d",*p); ++p; } }

4 Answers  


Categories