what is difference between ++(*p) and (*p)++
Answer Posted / 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 |
Post New Answer View All Answers
What math functions are available for integers? For floating point?
What is the difference between c &c++?
What is file in c preprocessor?
What is a good data structure to use for storing lines of text?
What are different types of variables in c?
what is the role you expect in software industry?
What is conio h in c?
What are file streams?
the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function
Explain what are linked list?
Are global variables static in c?
What is a union?
Tell me what is null pointer in c?
cavium networks written test pattern ..
What is the difference between typedef and #define?