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

ouput :value of x=5
bcoz sqr(x+1)=(x+1*x+1) if u substitute x=2 u will get 5
since '*' is having more priority than '+'

at the of prog if u add prinf("%d",x); u will get 2
bcoz x value is not changed

Is This Answer Correct ?    32 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a simple code fragment that will check if a number is positive or negative.

708


What is the difference between malloc calloc and realloc in c?

649


If I have a char * variable pointing to the name of a function ..

652


How can I remove the trailing spaces from a string?

616


What are compound statements?

629






What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

905


What is build process in c?

645


Explain the use of 'auto' keyword

679


What is difference between arrays and pointers?

584


What is omp_num_threads?

585


What are the preprocessor categories?

639


What is keyword in c?

604


What is preprocessor with example?

588


if p is a string contained in a string?

1406


Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant

668