Hello, World in C
The classic first C program. Press Run to try it, then change the code and run it again.
#include <stdio.h>
int main(void) {
printf("Hello, World!\n");
return 0;
}
Output
Press Run to see the output.
More C examples
- Sum of two numbers · Read two numbers with scanf and print their sum.
- Check a prime number · Test whether a number is prime by trying divisors up to its square root.
- Pointers: swap two numbers · Pass addresses to a function so it can change the caller’s variables.
- Sort an array (bubble sort) · Sort numbers by swapping neighbours until nothing moves.
- Structs and malloc · Build a small linked list on the heap, print it and free it.