int i = 0, a = 1, b = 1, temp = 0; printf("%d\n", a); printf("%d\n", b); while (i < n) { temp = b; b = a + b; a = temp; i += 1; print("%d\n", b); } return self; } Init_fibo(void) { rb_define_global_function("fibo", cfibo, 1); }
ability to declare C types. • Implicit, transparent conversion and interfacing between Ruby and C. • Compiles to C code so is super fast. • Simple and intuitive interfaces to the Ruby GC. • Interface with external C libraries.