Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Homepage
Description¶
This example is to demonstrate printing "Hello World!" to the command line. The printf statement can be very useful for debugging.
Examples¶
%c is used to print characters
// initialize some characters char x = 'a'; char y = 'b'; char z = 'c' // print characters to terminal printf("characters: %c,%c,%c",x,y,z); // would print 'characters: a,b,c'
%d is used to print integers
// initialize integer with value 42 int x = 42; printf("The answer is %d",x); // would print 'The answer is 42'
%f is used to print floating point numbers
// initialize pie with value 3.14 float pie = 3.14; printf("pie = %f ",pie); // would print 'p = 3.14'