惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
The Register - Security
The Register - Security
Stack Overflow Blog
Stack Overflow Blog
博客园 - 三生石上(FineUI控件)
T
Threat Research - Cisco Blogs
S
SegmentFault 最新的问题
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
AI
AI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
B
Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
C
Cybersecurity and Infrastructure Security Agency CISA
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
U
Unit 42
腾讯CDC
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Cloudflare Blog
H
Help Net Security
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
IT之家
IT之家
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Archives - TechRepublic
Security Archives - TechRepublic
L
LINUX DO - 热门话题
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
H
Heimdal Security Blog
博客园 - 聂微东
S
Securelist
大猫的无限游戏
大猫的无限游戏
Cloudbric
Cloudbric
Cisco Talos Blog
Cisco Talos Blog

博客园 - 阿武

Moto G 通话没声音 Android 手机技巧 一个Java程序的生死旅程 精妙语录 【Windows Phone 7】【软件发布】深圳通助手 & 深圳长途汽车查询 & 深圳地铁通 【Ruby】删除旧文件 京东自动抢购机 64位的处理器支持多大的内存? 将.NET Entity Framework 的 Cache模块移植到JAVA平台 做快乐的程序员 Q 语言初学者系列:(3)Lists 初级 KDB+性能分析:内存篇 Q 语言初学者系列:(2)基本数据类型 Q 语言初学者系列:(1)开门篇 熟悉的感觉 盘点自己两年来走过的路 [JAVA]你见过这样的switch吗? - 阿武 - 博客园 网站上图片"另存为" 为什么是 bmp 格式 经实验, 网线两端都接在交换机上并不会烧毁交换机
[C++ Primer] Passing an array to a function by reference/pointers -- sample
阿武 · 2011-06-28 · via 博客园 - 阿武

#include <cstdlib>
#include 
<iostream>using namespace std;// Takes a pointer to the array, and the size of the array.
void print_arr1(const int *arr, size_t size)
{
    
for (size_t ix = 0; ix != size; ++ix) {
        cout 
<< arr[ix] << ' ';
    }
    cout 
<< endl;
}
// Takes 2 pointers. One to the beginning of the array, 
// and one to 1 past the last element - just like iterating through a vector.
void print_arr2(const int *beg, const int *end)
{
    
for (/* empty */; beg != end; ++beg) {
        cout 
<< *beg << ' ';
    }
    
    cout 
<< endl;
}
// Takes an array of size 10 and uses it as a const reference.
void print_arr3(const int (&arr)[10])
{
    size_t size 
= 10;
    
for (size_t ix = 0; ix != size; ++ix) {
        cout 
<< arr[ix] << ' ';
    }
    cout 
<< endl;
}
int main() 
{
    
int arr[] = {0123456789};
    
int *parr = arr;
        
    print_arr1(parr, 
10);
    print_arr2(parr, parr
+10);
    print_arr3(arr);    
    
    
return EXIT_SUCCESS;
}