Chinaunix首页 | 论坛 | 博客
  • 博客访问: 927215
  • 博文数量: 146
  • 博客积分: 3321
  • 博客等级: 中校
  • 技术积分: 1523
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-29 10:32
文章分类

全部博文(146)

文章存档

2014年(2)

2013年(5)

2012年(4)

2011年(6)

2010年(30)

2009年(75)

2008年(24)

分类: C/C++

2010-06-13 09:18:02

c99标准中支持函数嵌套定义,做个小测试:

/*
 * Copyright (c) 2010--Meng Along
 *
 * The source code is released for free distribution under the terms of the GNU General Public License
 *
 *
 * Author: Meng Along
 * Created Time: 2010年06月13日 星期日 09时10分30秒
 * File Name: std.c
 * Description:
 * 测试c99中的函数嵌套定义
 */


#include <stdio.h>
#include <stdlib.h>

int fun1(void);
int main(int argc, char *argv[])
{
    fun1
();
    
return 0;
}

int fun1(void)
{
    
printf("in fun1!\n");

    
void fun2(void) {
        
printf("in fun2!\n");
    
}
    fun2
();
    
return 0;
}



$ gcc -std=c99 -o std std.c
$ ./std

in fun1!

in fun2!



阅读(2246) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~