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

What is a built-in function in C?

1 Answers  


what is object oriental programing?

1 Answers  


Determine if a number is a power of 2 at O(1).

2 Answers  


Why calloc is better than malloc?

0 Answers  


How to write a code for random pick from 1-1000 numbers? The output should contain the 10 numbers from the range 1-1000 which should pick randomly, ie ,for each time we run the code we should get different outputs.

12 Answers   NetApp,


who is the founder of c

19 Answers   College School Exams Tests, HP,


What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file

0 Answers  


I have a function which accepts, and is supposed to initialize,a pointer, but the pointer in the caller remains unchanged.

1 Answers  


main is a predefined or user define function if user defined why? if predefined whay?

12 Answers   TCS,


how to display 2-D array elements in spiral

2 Answers  


Is r written in c?

0 Answers  


What is main () in c?

0 Answers  


Categories