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 context in c?

0 Answers  


What are structure types in C?

0 Answers  


What are different types of pointers?

0 Answers  


What will be your course of action for a push operation?

0 Answers  


What is #define in c?

0 Answers  






a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor

0 Answers  


What is call by value in c?

0 Answers  


What is the use of parallelize in spark?

0 Answers  


What is a program flowchart?

0 Answers  


write a c program to change only the 3rd bit of the particular number such that other bits are not affected.. if bitnum=10(say.. it can be any no..

10 Answers   Bosch, Mind Tree,


In C language what is a 'dangling pointer'?

0 Answers   Accenture,


wat is the difference between array and pointer?

4 Answers   Wipro,


Categories