Answer Posted / 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 |
Post New Answer View All Answers
How to write a code for implementing my own printf() and
scanf().... Please hep me in this... I need a guidance...
Can you give an coding for c... Please also explain about
the header files used other than #include
What is difference between structure and union in c programming?
How old is c programming language?
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
What are pointers really good for, anyway?
Is there sort function in c?
What is a substring in c?
Explain how can you determine the size of an allocated portion of memory?
What are the different types of pointers used in c language?
What is the difference between printf and scanf in c?
How is a macro different from a function?
hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell
struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer
What does 1f stand for?
How can you tell whether two strings are the same?