difference between i++* and *++i

Answers were Sorted based on User's Feedback



difference between i++* and *++i..

Answer / ravi

i++* is meaningless , do u want to ask *++i and *i++ diff ?

*++i --> it increments the i then access the value poiting
by i

*i++ --> it first access the value pointed by i , then
increment the i ( increments pointer , not value)

Is This Answer Correct ?    21 Yes 2 No

difference between i++* and *++i..

Answer / gv_shreenivas

The postfix ++ and -- operators essentially have higher
precedence than the prefix unary operators. Therefore, *i++
is equivalent to *(i++); it increments i, and returns the
value which i pointed to before i was incremented. To
increment the value pointed to by i, use (*i)++ (or perhaps
++*i, if the evaluation order of the side effect doesn't
matter).

Ref:comp.lang.c FAQ list ยท Question 4.3

Is This Answer Correct ?    7 Yes 4 No

difference between i++* and *++i..

Answer / yathish m yadav

*++i
assuming i is declared as pointer
i will be first incremented to point to next location to
which it is pointing. then, the content of location to
which i is newly pointing will be assigned if any variable
is used like: a=*++i;
here since it is not assigned to any variable it will be
dicard.

i++*
if the statement is int a=i++*;
then i is incremented to point to next location of its type
then the content of that location is being copied to a
using *.

Is This Answer Correct ?    2 Yes 0 No

difference between i++* and *++i..

Answer / vignesh1988i

i++* wont work .... as for as i know.... it's meaningless

comin to *++i, i is a pointer holding an address so here ++
and * holds the same priority so we ll go for associativity
of these operators. it's RIGHT to LEFT.

so , address in 'i' will get incremented and then if that
address points to some value means it will print that value
or else it will have garbage value



thank u

Is This Answer Correct ?    3 Yes 2 No

difference between i++* and *++i..

Answer / rukmanee

In case of i++, it'll first assign the value of i and then
increment it's value by one. But in case of ++i, it 'll
first increment the value of i by 1 and then assign the new
value of i.This is the difference between i++ and ++i.

Is This Answer Correct ?    2 Yes 2 No

difference between i++* and *++i..

Answer / khaja

it wont work bcoz its meaning less
bcoz i++* is not an increment operator(post increment)
*++i is to not a pre increment operator...

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More C Interview Questions

4)What would be the output? main() { int num=425; pf("%d",pf("%d",num)); } a)Comp error b)4425 c)4253 d)3435 e)none

10 Answers  


What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25

0 Answers  


Can a void pointer point to a function?

0 Answers  


write a program in c language that uses function to locate and return the smallest and largest integers in an array,number and their position in the array. it should also find and return the range of the numbers , that is , the difference between the largest number and the smallest.

1 Answers  


how to find the given number is prime or not?

6 Answers   IMS, ING,






Program to display given 3 integers in ascending order

1 Answers   N Tech,


Write the syntax and purpose of a switch statement in C.

0 Answers   Adobe,


why programs in c are running with out #include<stdio.h>? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

0 Answers  


Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

0 Answers  


Which of the following is not a valid declaration for main ()? 1) int main() 2) int main(int argc, char *argv[]) 3) They both work

2 Answers  


why do we use # in c-language?

1 Answers  


What is key word in c language?

4 Answers   ABC,


Categories