ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
   
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
difference between i++* and *++i
 Question Submitted By :: Khemnath Chauhan
I also faced this Question!!     Rank Answer Posted By  
 
  Re: difference between i++* and *++i
Answer
# 1
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 ?    20 Yes 2 No
Ravi
 
  Re: difference between i++* and *++i
Answer
# 2
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
Gv_shreenivas
[ASD Lab]
 
 
 
  Re: difference between i++* and *++i
Answer
# 3
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
Vignesh1988i
 
  Re: difference between i++* and *++i
Answer
# 4
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
Khaja
 
  Re: difference between i++* and *++i
Answer
# 5
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
Rukmanee
 
  Re: difference between i++* and *++i
Answer
# 6
*++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
Yathish M Yadav
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this  1
How pointer is benefit for design a data structure algorithm?  2
what is function pointer? Wipro2
write an algorithm to get a sentence and reverse it in the following format: input : I am here opuput: Here Am I note: first letter of every word is capiatlised  3
f(x,y,z) { y = y+1; z = z+x; } main() { int a,b; a = 2 b = 2; f(a+b,a,a); print a; } what is the value of 'a' printed  5
main() { printf(5+"good morning"); printf("%c","abcdefgh"[4]); }the o/p is morning and e...how someone explain  1
Write a program for deleting duplicate elements in an array Subex3
what are the various memory handling mechanisms in C ? HP4
String concatenation  2
write a program of palindrome(madam=madam) using pointer? L&T5
How to find the digits truncation when assigning the interger variable to the character variables. like int i=500; char x = i : here we have truncation. how to find this. another ex: i =100; char x=i. here we do not have truncation. HCL1
write function to reverse char array ... without using second array  2
 
For more C Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2012  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com