#define d 10+10
main()
{
printf("%d",d*d);
}
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
#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
Why malloc is faster than calloc?
what is inline function?
Given an array of length N containing integers between 1 and N, determine if it contains any duplicates.
Explain the difference between #include "..." And #include <...> In c?
difference between semaphores and mutex?
what is c programming?
How the C program can be compiled?
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;
What is f'n in math?
what is ram?
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; } }