博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Learn c++ step by step (转)
阅读量:2505 次
发布时间:2019-05-11

本文共 733 字,大约阅读时间需要 2 分钟。

Learn c++ step by step (转)[@more@]

通过这个例子边可以看出区别,而且注意一定要用标准C++的样式

打好基础

#include

#include

using namespace std;

int add1CallByValue(int t); //define  function

void add1ByPointer(int* t);

void add1ByReferrence(int& t);

int main(void)

{
  int count=12;
  std::cout<  add1CallByValue(count); //call by value
  std::cout< 
  std::cout<  add1ByPointer(&count); //call by pointer
  std::cout< 
  std::cout<  add1ByReferrence(count); //call by referrence
  std::cout<  system("pause");
  return(0);
}

int add1CallByValue(int t)

{
  return(t+1);
}

void add1ByPointer(int* p)

{
  *p+=1;
}

void add1ByReferrence(int& t)

{
  t+=1;
}

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10748419/viewspace-963354/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10748419/viewspace-963354/

你可能感兴趣的文章
量化策略回测DCCV2
查看>>
mongodb查询优化
查看>>
五步git操作搞定Github中fork的项目与原作者同步
查看>>
git 删除远程分支
查看>>
删远端分支报错remote refs do not exist或git: refusing to delete the current branch解决方法
查看>>
python multiprocessing遇到Can’t pickle instancemethod问题
查看>>
APP真机测试及发布
查看>>
通知机制 (Notifications)
查看>>
10 Things You Need To Know About Cocoa Auto Layout
查看>>
一个异步网络请求的坑:关于NSURLConnection和NSRunLoopCommonModes
查看>>
iOS 如何放大按钮点击热区
查看>>
ios设备唯一标识获取策略
查看>>
获取推送通知的DeviceToken
查看>>
Could not find a storyboard named 'Main' in bundle NSBundle
查看>>
CocoaPods安装和使用教程
查看>>
Beginning Auto Layout Tutorial
查看>>
block使用小结、在arc中使用block、如何防止循环引用
查看>>
iPhone开发学习笔记002——Xib设计UITableViewCell然后动态加载
查看>>
iOS开发中遇到的问题整理 (一)
查看>>
Swift code into Object-C 出现 ***-swift have not found this file 的问题
查看>>