what is the difference between postfix and prefix unary
increment operators?

Answers were Sorted based on User's Feedback



what is the difference between postfix and prefix unary increment operators?..

Answer / rukmanee

In prefix operator,the value of the operand increase by one
and then assign the new value to that operand and print
it.In postfix operator,the value of the operand is assigned
at first and then increment it's value by one.
This is the difference between postfix and prefix unary
increment operators.

Is This Answer Correct ?    8 Yes 1 No

what is the difference between postfix and prefix unary increment operators?..

Answer / tarun kumar

In prefix operator In postfix operator
#include<iostream.h> #include<iostream.h>
#include<coino.h> #include<coino.h>
void main() void main()
{ {
int i=10; int i=10;
int j=++i; int j=i++;
cout<<j; cout<<j;
getch(); getch();
} }
OUTPUT:11 OUPUT:10

Is This Answer Correct ?    3 Yes 1 No

what is the difference between postfix and prefix unary increment operators?..

Answer / bhupender

PER FIX UNARY INCREMENT OPERATION IS ++I
POSTT FIX UNARY INCREMENT OPERATION IS i++
WHEN WE USE THIS IN PROGRAM THE RESULT WILL
FOR ++i IS

LIKE TWO VERIABLE INT A=5 AND B=++A+5 THEN
IN RESULT IT SHOWS A =5 BUT B WILL 10(5+5)
BUT IN POST FIX IT
A=5 BUT B= A++ MEANS A+1 AND RESULT FOR B WILL 11

Is This Answer Correct ?    2 Yes 10 No

Post New Answer

More C Interview Questions

write a c program to find biggest of 3 number without relational operator?

12 Answers   TCS, Wipro,


1 1 1 1 2 1 1 3 3 1 1 4 6 4 1

1 Answers  


How can I get the current date or time of day in a c program?

0 Answers  


Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?

0 Answers  


What is sizeof int in c?

0 Answers  






If you know then define #pragma?

0 Answers  


What are pointers? What are different types of pointers?

0 Answers   Fidelity,


Write a program to exchange two variaables without temp

9 Answers   Geometric Software,


Discuss the function of conditional operator, size of operator and comma operator with examples.

0 Answers   TCS,


who did come first hen or agg

15 Answers   Infosys,


Given a number N, product(N) is the product of the digits of N. We can then form a sequence N, product(N), product(product(N))… For example, using 99, we get the sequence 99, 99 = 81, 81 = 8. Input Format: A single integer N Output Format: A single integer which is the number of steps after which a single digit number occurs in the sequence. Sample Test Cases: Input #00: 99 Output #00: 2 Explanation: Step - 1 : 9 * 9 = 81 Step - 2 : 8 * 1 = 8 There are 2 steps to get to this single digit number. Input #01: 1137638147

2 Answers  


what are the difference between ANSI C and Let Us c and Turbo C

4 Answers   LG Soft,


Categories