Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what is difference between ++(*p) and (*p)++

Answers were Sorted based on User's Feedback



what is difference between ++(*p) and (*p)++..

Answer / umamaheswari

p is a pointer variable which is holding the address of
another variable ,*p indicates the value that stored in
particular address

++(*p)-the value of the particular variable which is stored
in p is first incremented and used by next instruction

(*p)++ -the value of the particular variable which is
stored is executed or used by next instruction as it is
what it was,if it is any looping statement first time the
loop will be executed with the original value while doing
the second looping it is incremented by 1

Is This Answer Correct ?    3 Yes 2 No

what is difference between ++(*p) and (*p)++..

Answer / vint

++(*p) (or) ++*p -> Pre-increment the Value
(*p)++ -> Post-increment the value

*++p -> Increment the Position and then obtain the Value
*p++ (or) *(p++) -> Obtain the Value and then increment the Position

Example:
#include<stdio.h>
void main()
{
char str[10] = "Helyo";
char *p = str;
printf("%c
",++(*p)); // Pre-Increment the Value -> I
printf("%c
",++*p); // Pre-Increment the value -> J
printf("%c
",(*p)++); // Post-Increment the value -> J and increment to K

printf("%c
",*p++); // Post-Increment the position -> K and move to next position i.e. e
printf("%c
",*(p++)); // Post-Increment the position -> e and move to next position i.e. l
printf("%c
",*++p); // Pre-Increment the position and obtain value -> y

}

Is This Answer Correct ?    1 Yes 0 No

what is difference between ++(*p) and (*p)++..

Answer / srinivas

++(*p)as this means the first the addres is increneted and
then address is assgined

*p++ as this mean that the address is assign to it then the
address is incremented

Is This Answer Correct ?    1 Yes 2 No

what is difference between ++(*p) and (*p)++..

Answer / amaresh chandra das

++(*p)-> Here ,increments the address of p
(*p)++ -> Here , Increments the Value of p

Is This Answer Correct ?    5 Yes 9 No

what is difference between ++(*p) and (*p)++..

Answer / sonal

++(*p) it will increase pointer value to one value
(*p)++ will refer to next memory location

Is This Answer Correct ?    1 Yes 5 No

what is difference between ++(*p) and (*p)++..

Answer / pradeep......

Both are same ..................
reult will not differ in both operations....

#include <stdio.h>
#include <stdlib.h>
//#include <ctype.h>
void main()
{
char *ptr="hello";
clrscr();
//++(*ptr);
(*ptr)++;
printf("%s\n",ptr);
getch();
}


check this code..........

Is This Answer Correct ?    1 Yes 8 No

what is difference between ++(*p) and (*p)++..

Answer / savita

++(*p) means address that contained in p is incremented.

(*p)++ in this case since both the operator are unary
operator , so it's priority is from right to left.Hence here
first address that contained in p is incremented & then
gives the value at that address.

Is This Answer Correct ?    0 Yes 8 No

Post New Answer

More C Interview Questions

what information does the header files contain?

6 Answers   BSNL, Cisco, GDA Technologies,


Explain output of printf("Hello World"-'A'+'B'); ?

0 Answers  


what is the use of macro program

1 Answers   TCS,


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

0 Answers  


What does the message "warning: macro replacement within a string literal" mean?

1 Answers  


write the program to find multiplication of 2-D matrix??????????

1 Answers  


What is the difference between NULL and NUL?

0 Answers   Aspire, Infogain,


Difference between for loop and while loop?

1 Answers  


matrix multiplication fails introspect the causes for its failure and write down the possible reasons for its failurein c language.

5 Answers   TCS,


write a program in c to print **** * * * * ****

1 Answers   TCS,


What is page thrashing?

0 Answers  


What are function pointers? Provide an example.

1 Answers  


Categories