Difference between ++*p, *p++ and *++p
The pre and post increment with *, I am confused here. Is it pointer in the first two cases?
- 5961 दृश्य
- 2 उत्तर
-
-
- 22 मई
- 0 टिप्पणी
-
-
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 अप्रैल
- 0 टिप्पणी
-
- Why C language is introduced? Explain your answer
- Trade crypto anytime
- Left Shift and Right Shift Operators in C
- can u define type of pointer ??
- What does a person require to opt C programming as a career?
- What are jump statements in c language?
- What is the eligibility criteria for cracking the C Progamming Exam 2018?
- Should I learn C before C++? Explain your answer
- What does it mean to be C ? Why its called C programming?
- Write a program to read the marks of 50 students in a class and display the following:
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 /