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 is #define in c?
What does sizeof int return?
What is an identifier?
What is linear search?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..
What is atoi and atof in c?
what is the significance of static storage class specifier?
What are dangling pointers in c?
How do you print an address?
What is the c value paradox and how is it explained?
In C programming, how do you insert quote characters (‘ and “) into the output screen?
Differentiate between calloc and malloc.
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
what is a constant pointer in C