当前位置:网站首页>*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 **
边栏推荐
猜你喜欢
Orin installs CUDA environment
7. Oracle table structure
1. Create Oracle database manually
Redis-01. First meet redis
Vant weapp swippecell set multiple buttons
GDB code debugging
Orin 安装CUDA环境
Install opencv -- CONDA to establish a virtual environment and add the kernel of this environment in jupyter
数据库Mysql全部
Sre core system understanding
随机推荐
Paper reading report
vsCode创建自己的代码模板
时间很快,请多做有意义的事情
[moviepy] unable to find a solution for exe
Architecture
4.Oracle-重做日志文件管理
2022/6/29-日报
H5 module suspension drag effect
微信小程序路由再次跳转不触发onload
Xavier CPU & GPU high load power consumption test
A brief introduction to heading/pitch/roll and omega/phi/kappa
【高德地图POI踩坑】AMap.PlaceSearch无法使用
MySQL (UDF authorization)
在本地搭建一个微服务集群环境,学习自动化部署
Install opencv -- CONDA to establish a virtual environment and add the kernel of this environment in jupyter
How to make water ripple effect? This wave of water ripple effect pulls full of retro feeling
4. Oracle redo log file management
Use ffmpeg to rotate, flip up and down, and flip horizontally
7. Oracle table structure
Utf8 encoding