#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?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / poorna
Warning: Function Should have return value........
| Is This Answer Correct ? | 4 Yes | 5 No |
What is 'makefile' in C langauage? How it be useful? How to write a makefile to a particular program?
#define MAX 3 main() { printf("MAX = %d ",MAX ); #undef MAX #ifdef MAX printf("Vector Institute”); #endif }
What is the meaning When we write "#include" what is # and what does include does there???
whitch value return void main?
Explain what is dynamic data structure?
what is the difference between global variable & static variable declared out side all the function in the file.
write a program to sort the elements in a given array in c language
what are the various memory handling mechanisms in C ?
What are the complete rules for header file searching?
5. distance conversion: Convert a distance from miles to kilometers .there are 5280 feets per mile,12 inches per foot .2.54 centimeters per inch and 100000centimeters per kilometer
What is an auto keyword in c?
How to calculate Total working time using Login and logout?
2 Answers CTS, Cygnus, Infosys, Signal Networks, TCS, Wipro,