当前位置:网站首页>18. [precautions for pointer pointing to two-dimensional array]
18. [precautions for pointer pointing to two-dimensional array]
2022-07-21 20:45:00 【Li is struggling】
【 The pointer points to a two-dimensional array p=&a[0][0]】
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a[2][2] = {1,2,3,4};
int* p;
p = &a[0][0];
for (int i = 0; i < 4; i++)
{
cout << setw(2) << *(p+i) ;
}
return 0;
}
【 Pointer to two-dimensional array cannot be used *p=a[0]】
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a[2][2] = {1,2,3,4};
int* p;
*p = a[0];
for (int i = 0; i < 4; i++)
{
cout << setw(2) << *(p+i) ;
}
return 0;
}
边栏推荐
猜你喜欢
xcode升级后找不到 C语言头文件 stdio.h的解决办法
微信小程序request:fail -2:net::ERR_FAILED
[c language] selecting the loop can also play the code like this to show the country of light
xml解析
Custom MVC principle
解决safari浏览器拦截window.open
uniapp自定义导航栏按钮及按钮点击事件
鼠标禁用样式(cursor: not-allowed)无效和鼠标禁用事件(pointer-events: none)冲突
使用tailwind在谷歌浏览器上,button会出现蓝色背景的问题
Wechat applet request:fail -2:net:: err_ FAILED
随机推荐
OpenFoam小技巧
SimpleDateFormat正确使用
sonarLint使用、介绍
[c language] selecting the loop can also play the code like this to show the country of light
Uniapp determines whether the user's Bluetooth is turned on
在控制台输出语句
Nodejs读取并解析xml的DOM
Custom MVC framework implementation
推荐一个好用的 所见即所得的 markdown 编辑器 Mark Text
移动安全入门指南
Mise en œuvre personnalisée du cadre MVC
Relationship between prototype, prototype chain, constructor and instance
JS operation mechanism
图片横向瀑布流
Vs, MATLAB, leetcode annotation shortcut key
Typescript基础学习记录
Nodejs+Express使用 cors 中间件解决跨域问题
一场优雅“面试“的感悟
MySQL functions
express+ejs+swagger-ui-dist 打造及时更新的rest api 在线接口文档