令我迷惑的c语言参数格式
之前看ruby hacking guide的时候,经常看到c文件中出现很奇怪的写法,当时是感觉可能自己的c水平有限,看不懂其中的原理,故而没有继续看下去。今天又看到了类似的写法,突然有一种冲动,一定要把它弄懂。结果,其实很简单。。。。
之前看到这样的代码,我一直很纳闷,为什么这样写:
VALUErb_str_new(ptr, len) const char *ptr; long len;{ return str_new(rb_cString, ptr, len);}#include<stdio.h>int add(int,int);int main(){ printf("%d",add(3,4)); return 0;}int add(a,b)int a;int b;{ return a+b;}