Hello World!
Part of the Fundamentals section of Coddy's C journey — lesson 2 of 63.
The "Hello World!" program is simple and outputs Hello, World! to the screen. It's often used as a first program when learning a new programming language.
In C, we use the printf() function to print output to the console. The text to be printed is placed within double quotes and followed by a semicolon.
#include <stdio.h>
int main() {
printf("Hello, World!");
}The #include <stdio.h> line includes the standard input/output library, which contains the printf() function.
Challenge
EasyUse the code view to write a program that outputs Hello, World!
Note that anything inside quotation marks is case sensitive. For example:
printf("Hello, World!");printf("hello, world!");are different things (notice the capital letters in the first line).
Cheat sheet
To print to the console in C, use printf():
#include <stdio.h>
int main() {
printf("Hello, World!");
}The #include <stdio.h> line includes the standard input/output library containing the printf() function.
Try it yourself
#include <stdio.h>
int main() {
// Write your code here
}This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
3Operators
Arithmetic OperatorsModulo OperatorIncrement/DecrementAssignment OperatorsRelational OperatorsLogical Operators Part 1Logical Operators Part 2Logical Operators Part 3Recap Challenge