当前位置:网站首页>*P++, (*p) + +, * (p++) differences
*P++, (*p) + +, * (p++) differences
2022-07-05 06:47:00 【like_ new_ human】
First of all, understand ()* ++ Priority relationship
() The priority is highest , Next is p++ Post auto increment ,* and ++p The former auto increment priority is the same
The following code is used to illustrate the difference between the three
# include <stdio.h>
int main (void)
{
int a[5] = {
1,2,3,4,5};
int* p = a;
int A;
// Now? p Point to a[0]
A = *p++;
printf ("*p++ = %d\n",A);
printf ("*p = %d\n",*p);
//A by 1 *p by 2 *p Assign first to A One more
p = a;
A = (*p)++;
printf ("(*p)++ = %d\n",A);
printf ("*p = %d\n",*p);
//A by 1 *p by 2 *p Equivalent to a[0] hold a[0] The value is assigned to A a[0] Since the increase again 1
p = a;
A = *(p++);
printf ("*(p++) = %d\n",A);
printf ("*p = %d\n",*p);
//A by 2 *p by 2 *(p++) And *p++ Equivalent ++ It's priority
return 0;
}
**--- A cute new little broken article **
边栏推荐
- Client use of Argo CD installation
- 6-2 sequence table operation set
- Configuration method and configuration file of SolidWorks GB profile library
- 4. Oracle redo log file management
- Volcano resource reservation feature
- Package webapp or H5 pages into apps
- 达梦数据库全部
- H5 模块悬浮拖动效果
- Positive height system
- 在新线程中使用Handler
猜你喜欢
Vant weave swipecell sets multiple buttons
Dameng database all
Bit of MySQL_ OR、BIT_ Count function
TCP's understanding of three handshakes and four waves
[moviepy] unable to find a solution for exe
‘mongoexport‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件。
Package webapp or H5 pages into apps
Rehabilitation type force deduction brush question notes D1
Client use of Argo CD installation
namespace
随机推荐
Pycahrm reports an error: indentation error: unindent does not match any outer indentation
摄像头的MIPI接口、DVP接口和CSI接口
Sum of two numbers, the numbers in the array are converted to decimal, added, and output inversely
NVM Downloading npm version 6.7.0... Error
Volcano 资源预留特性
Using handler in a new thread
6-4 search by serial number of linked list
mysql设置触发器问题
Technology blog learning website
5.Oracle-錶空間
Package webapp or H5 pages into apps
Ffmpeg build download (including old version)
Vscode editor
Getting started with typescript
H5内嵌App适配暗黑模式
Rehabilitation type force deduction brush question notes D3
RecyclerView的应用
Knapsack problem acwing 9 Group knapsack problem
Redis-02.Redis命令
cgroup_ memcg