#include <stdio.h>
#define sqr(x) (x*x)
int main()
{
int x=2;
printf("value of x=%d",sqr(x+1));
}
What is the value of x?
Answer Posted / jugal
The OUTPUT of the program wud be
"value of x=9"
NOTE:
#define sqr(x) (x*x) and
#define sqr(x) x*x
are two very different things
what Divakar and all are saying is referring to the 2nd
one, where as in this case the 1st one is given
Coming to the actual question
The value of x will remain 2, since its value is not being
changed anywhere in the program, its just being passed to a
macro, but NOT modified there either.
Try adding a line at the end of the program
printf("x=%d",x);
Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Where we use clrscr in c?
What is the benefit of using const for declaring constants?
Is file a keyword in c?
When should the volatile modifier be used?
design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.
Explain 'far' and 'near' pointers in c.
Explain the term printf() and scanf() used in c language?
What is variables in c?
What is auto keyword in c?
can anyone please tell about the nested interrupts?
Why shouldn’t I start variable names with underscores?
Explain bit masking in c?
What is the best way to store flag values in a program?
Difference between Function to pointer and pointer to function
How can I generate floating-point random numbers?