当前位置:网站首页>*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 **
边栏推荐
- Redis-02.Redis命令
- Chinese remainder theorem acwing 204 Strange way of expressing integers
- Inclusion exclusion principle acwing 890 Divisible number
- Xavier CPU & GPU high load power consumption test
- 数据库Mysql全部
- SolidWorks template and design library are convenient for designers to call
- TypeScript入门
- Install opencv -- CONDA to establish a virtual environment and add the kernel of this environment in jupyter
- Error: “MountVolume.SetUp failed for volume pvc 故障处理
- Genesis builds a new generation of credit system
猜你喜欢
达梦数据库全部
Knapsack problem acwing 9 Group knapsack problem
Orin two brushing methods
【MySQL8.0不支持表名大写-对应方案】
LSA Type Explanation - detailed explanation of lsa-2 (type II LSA network LSA) and lsa-3 (type III LSA network Summary LSA)
Design specification for mobile folding screen
AE tutorial - path growth animation
Interval problem acwing 906 Interval grouping
Orin installs CUDA environment
Volcano resource reservation feature
随机推荐
Vant weave swipecell sets multiple buttons
Client use of Argo CD installation
UIO driven framework
MySQL (UDF authorization)
[MySQL 8.0 does not support capitalization of table names - corresponding scheme]
SolidWorks template and design library are convenient for designers to call
The problem of Chinese garbled code in the vscode output box can be solved once for life
International Open Source firmware Foundation (osff) organization
Huawei bracelet, how to add medicine reminder?
Record of problems in ollvm compilation
[QT] QT multithreading development qthread
[Chongqing Guangdong education] National Open University 2018 autumn 0702-22t contemporary Chinese political system reference questions
SRE核心体系了解
Volcano 资源预留特性
Pycahrm reports an error: indentation error: unindent does not match any outer indentation
Cookie、Session、JWT、token四者间的区别与联系
2022-5-第四周日报
Redis-01. First meet redis
【MySQL8.0不支持表名大写-对应方案】
Orin installs CUDA environment