#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 / fazlur

Macro will blindly substitutes, it doesn't calculate. So
remember whenever you encounter the macro, you first
substitute the value then calculate later. Ofcourse the
answer would be 5 in this case.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain Function Pointer?

681


Why should I prototype a function?

642


What are variables c?

621


What are types of preprocessor in c?

617


How can type-insensitive macros be created?

701






What are the different types of endless loops?

624


Why is it that not all header files are declared in every C program?

683


Can a pointer be static?

625


What is the difference between formatted&unformatted i/o functions?

617


What does the characters “r” and “w” mean when writing programs that will make use of files?

858


State the difference between realloc and free.

635


What is the use of in c?

578


how to find anagram without using string functions using only loops in c programming

2718


Explain why c is faster than c++?

575


#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }

783