xxxxxxxxxx
// Welcome to CIR Playground!
//
// CIR is a compile-time evaluation and metaprogramming system
// for the C Programming Language. CIR Playground lets you try out CIR without
// the hassle of building and installing it on your computer.
// Let's start with a fibonacci function that is evaluated at compile time.
// Click "Run" to see the result!
#include <stdio.h>
static int fib(int n) {
int a = 0, b = 1;
for (int i = 0; i < n; i = i + 1) {
int c = b;
b = a + b;
a = c;
}
return a;
int main(void) {
// The use of @ evaluates fib(20) at compile time.
// First, try running this program as-is by clicking "Run"!
// Next, try removing the @, click "Run", and compare the result!
printf("The answer is: %d\n", @fib(20));
return 0;