C

Scope

  • Provides lexical scope to eliminate global variables
  • Functions exist in global namespace
  • Functions may not be declared within other functions

Typing

  • Variable are statically typed
  • Type rules are weakly enforced
  • Implicit conversions are possible

Running C Programs

  • Compile to executable: gcc source.c --output executable
  • Run the executable: ./executable
  • tcc can run C compile and run in one step: tcc -run source.c
int a = 1;
float b = 2.0;

printf("%f\n", a + b); // Prints 3.0
char * a = 1;
int b = 2;

printf("%d\n", a + b); // Prints 3