What is the difference between *p+1 and *(p+1)
*p 1 and *(p 1) The differences are: 1. Different priorities. In p 1, p will be dereferenced first, while in *(p 1), p 1 will be calculated first; 2 , the operation objects are different, p 1 is to dereference p first, and (p 1) is to add p to 1 first; 3. The results are different, p 1 is to add 1 to the value of the object pointed to by p, (p 1) is to add 1 to the value of the object pointed to by p. The value of the next object.
The operating environment of this tutorial: Windows 10 system, DELL G3 computer.
What is the difference between *p 1 and *(p 1)? I believe that many netizens are still not clear about it. Today, the editor has brought you relevant tutorials, hoping to help you.
1. Different priorities
p 1 and (p 1) have different operation priorities. In C/C, operators (dereference operator) and (addition operator) have different precedence. The addition operator has lower precedence than the dereference operator. Therefore, in p 1, p will be dereferenced first, and then 1 will be added; in *(p 1), because adding parentheses changes the priority, p 1 will be calculated first and then dereferenced.
2. Different operation objects
The objects operated by p 1 and (p 1) are also different. p 1 first dereferences p, gets the object pointed to by p, and then adds 1 to the object. And (p 1) first adds 1 to p to point to the next object, and then dereferences the new object.
3. The results are different
The results of p 1 and (p 1) are different. p 1 first dereferences p and then adds 1, so the result is the value of the object pointed to by p plus 1. And (p 1) adds 1 to p and then dereferences it, so the result is the value of the next object pointed to by p.
The above is the detailed content of What is the difference between *p+1 and *(p+1). For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
