Print 42

Created on May 22, 2024 by Julien Palard

Write a program displaying the number 42.

What you'll learn

In this exercise you'll learn to use a function by trying the printf function from stdio.h.

A function is a named thing that does something specific:

  • the printf function displays what's given to it,
  • the strlen function measures the length of the string we give to it,

The syntax to make a function work is called a "function call", to make printf display the string "Hello world" the syntax is:

printf("Hello world\n");

or:

printf("%s\n", "Hello world");

Advice

Don't hesitate to hit the "Submit" button, do as many test as you like, until you feel confident you understand how print works.

There's no corrections yet, hit the `Submit` button to send your code to the correction bot.
Keyboard shortcuts:
  • Ctrl-Enter: Send your code to the correction bot.
  • Escape: Get back to the instructions tab.
(Ctrl-Enter)