Difference between ++*p, *p++ and *++p
The pre and post increment with *, I am confused here. Is it pointer in the first two cases?
- 5946 Views
- 2 Answers
-
-
- 22 May
- 0 Comment
-
-
The expression ++*p has two operators of same precedence, so compiler looks for assoiativity. Associativity of operators is right to left. Therefore the expression is treated as ++(*p). Therefore the output of first program is “arr[0] = 11, arr[1] = 20, *p = 11“.br /br /The expression *p++ is treated as *(p++) as the precedence of postfix ++ is higher than *. Therefore the output of second program is “arr[0] = 10, arr[1] = 20, *p = 20“.br /br /The expression *++p has two operators of same precedence, so compiler looks for assoiativity. Associativity of operators is right to left. Therefore the expression is treated as *(++p). Therefore the output of second program is “arr[0] = 10, arr[1] = 20, *p = 20“.
-
- 02 Apr
- 0 Comment
-
- C programming Program to print the Fibonacci series up to n numbers.
- What are the best books for C Programming preparations?
- The best CBD for Life
- What are storage classes in C language?
- Left Shift and Right Shift Operators in C
- Short circuit logical operators used in C language.
- Trade crypto anytime
- How will you print “Hello World” without semicolon?
- Write a program to store 5 elements in the array P and 3 elements in the array Q.Produce a third array R after joining the array P and Q.Display the resultant array.
- Ищу достойного мужчину!
Thanks for sharing excellent information's. Your web-site is very cool. I'm impressed by the details that you have on this web site with a rel='nofollow' href="https://geometrydash-lite.io"geometry dash lite/a. br /