difference between i++* and *++i
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
sum of two integers values only other then integer it should print invalid input.
Write an interactive c program that will encode or decode a line of text. To encode a line of text, proceed as follows: Convert each character, including blank spaces, to its ASCII equivalent. Generate a positive random integer. Add this integer to the ASCII equivalent of each character. The same random integer will be used for the entire line of text. Suppose that N1 represents the lowest permissible value in the ASCII code, and N2 represents the highest permissible value. If the number obtained in step 2 above exceeds N2, then subtract the largest possible multiple of N2 from this number, and add the remainder to N1. Hence the encoded number will always fall between N1 and N2, and will therefore always represent some ASCII character. Display the characters that correspond to the encoded ASCII values. The procedure is reversed when decoding a line of text. Be certain, however, that the same random number is used in decoding as was used in encoding.
1 Answers Amazon, CSJM, HCL, Microsoft, TCS, Wipro,
write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list
define switch statement?
How do we make a global variable accessible across files? Explain the extern keyword?
Why preprocessor should come before source code?
what r callback function?
what is the difference between #include<> and #include”…”?
n=7623 { temp=n/10; result=temp*10+ result; n=n/10 }
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
What is volatile variable how do you declare it?
How can you check to see whether a symbol is defined?