Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
#include <stdio.h> /* Preprocessor constant — no type, no scope */ #define PI 3.14159265358979 /* const global — typed, file scope */ const int MAX_SIZE = 256; /* enum constants */ enum Direction { NORTH = 0, EAST, SOUTH, WEST }; /* static global — visible only in this file */ static int call_count = 0; void increment(void) { static int local_persist = 0; /* retains value between calls */ local_persist++; call_count++; printf("local_persist=%d call_count=%d ", local_persist, call_count); } int main(void) { const double radius = 5.0; double area = PI * radius * radius; printf("Area = %.4f ", area); enum Direction dir = EAST; printf("Direction value: %d ", dir); /* prints 1 */ increment(); increment(); increment(); return 0; }
Result
Open