Razzi's guide to c
c is the og language, still widely used but with some sharp edges that are mostly not a problem in other languages. If you’re not careful you can write insecure software; since there aren’t so many checks on buffers and the execution model is so straightforward, attacks like stack smash are possible.
And c will always have to have absolute power, since it is used for things like operating systems and embedded controllers.
Here’s a simple program in c. Put it in a file like main.c:
#include <stdio.h>
int main() {
printf("Hello, world!\n");
}
Compile it like so:
$ gcc main.c
And run it:
$ ./a.out
You’ll probably want to name your executable to something other than a.out:
$ rm a.out
$ gcc main.c -o main
$ ./main
Hello, world!