Chinaunix首页 | 论坛 | 博客
  • 博客访问: 387459
  • 博文数量: 81
  • 博客积分: 45
  • 博客等级: 民兵
  • 技术积分: 608
  • 用 户 组: 普通用户
  • 注册时间: 2012-10-22 11:46
个人简介

一个愤青

文章分类

全部博文(81)

文章存档

2015年(40)

2014年(29)

2013年(11)

2012年(1)

我的朋友

分类: LINUX

2015-03-17 21:39:39

#include

typedef struct _stu {
    const char *name;
    int number;
} stu;

#define func(...) my_func((struct _stu){__VA_ARGS__})

void my_func(struct _stu ms)
{
    printf("%s: %d\n",
           ms.name ? : "untitled", ms.number);
}

int main(void)
{
    func("three", 3);
    func("hello");
    func(.name = "zero");
    func(.number = 1, .name = "argc",);
    func(.number = 42);

    my_func((struct _stu){"hello lua", 200});
    
    return 0;
}
阅读(920) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~