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

main() { char *ptr = "Ramco Systems"; (*ptr)++; printf("%s\n",ptr); ptr++; printf("%s\n",ptr); } Find the Outputs?

9 Answers   BTBP, CitiGroup,


int *a[5] refers to

12 Answers   TCS,


What does c mean?

0 Answers  


Explain how to reverse singly link list.

0 Answers  


When is a void pointer used?

0 Answers  






What is dangling pointer in c?

0 Answers  


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; }

3 Answers   Honeywell,


What are the functions to open and close the file in c language?

0 Answers  


How to reverse a string using a recursive function, without swapping or using an extra memory?

31 Answers   Cisco, Mind Tree, Motorola, Ophio, Sony, TCS, Wipro,


ratio,age,persentage

0 Answers  


What is the difference between functions abs() and fabs()?

0 Answers  


What is queue in c?

0 Answers  


Categories