码迷,mamicode.com
首页 > 其他好文 > 详细

2.4 函数的声明与定义

时间:2015-05-14 13:53:48      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:

函数可以先声明后定义,如下:

#include<iostream>
int show(int, int);//函数声明
int main(){
    int a = 1, b = 2, c;
    c = show(a, b);
    std::cout << c << std::endl;
}

//函数定义
int show(int a, int b){
    return a + b;
}

 

2.4 函数的声明与定义

标签:

原文地址:http://www.cnblogs.com/cplusplus-study/p/4503075.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!