#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

Is c compiled or interpreted?

0 Answers  


What are volatile variables in c?

0 Answers  


Define function ?Explain about arguments?

2 Answers   Geometric Software, Infosys,


What is the use of linkage in c language?

0 Answers  


Hi Every one......... Please Any body give me the answer for my question. Is it possible to print the word "PRINT F", without using printf() statement in C-Language.

4 Answers  






Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?

0 Answers  


Define and explain about ! Operator?

0 Answers  


What is wrong with this code such that it doesnt produce the input reversed? #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char Space = ' '; char LineOfText; float count; LineOfText = getchar(); while ((LineOfText = getchar()) != '/n'); { count = strlen(LineOfText) - 1; while (count >= 0) { putchar(LineOfText[count]); count--; } } getchar(); return 0; }

2 Answers  


Why do we need a structure?

0 Answers  


What is an array in c?

0 Answers  


How old is c programming language?

0 Answers  


Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix

0 Answers   CLG,


Categories