what is the output of below
int n=10;
(n++)++;
printf("%d",n);
Answers were Sorted based on User's Feedback
Answer / kirankumaryakkala
ans. error:Lvalue required
why? Lvalue means leftside assignment value,
here, first it goes to increment on N, again it is going to
increment, before going to increment second time, you should
allocate one varibale that holds the first time increment
value, other wise from where to it increment...
Is This Answer Correct ? | 11 Yes | 1 No |
Answer / deepak kumar
error : lvalue required.
n++ return 10 and after that n will increase to 1.
so now n=11
but next operation (postfix operator) is performing on
constant value 10 which is returned by (n++) operation.
it actually try to assign 11 to constant value 10. it is not
possible .
firstly we have to store it in a variable and then increment
can take place..
Is This Answer Correct ? | 9 Yes | 2 No |
who is the founder of c
19 Answers College School Exams Tests, HP,
What is a protocol in c?
Whats s or c mean?
What does it mean when a pointer is used in an if statement?
What is typedef?
What is array in c with example?
An interactive c program to read basic salary of 15 persons. each person gets 25% of basic as HRA, 15%of basic as conveyance allowances, 10%of basic as entertainment allowances.The total salary is calculated by adding basic+HRA+CA+EA.Calculate how many out of 15 get salary above 10,000.Rs also print the salary of each employee
what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; }
WHAT IS C?
what is compiler
Which control loop is recommended if you have to execute set of statements for fixed number of times?
What is #include stdlib h?