{{keywords>wiki library source code example reference}}
===== printf =====
#include /* including standard library */
//#include /* uncomment this for Windows */
int printf ( const char * restrict format, ... );
==== Arguments ====
The function printf prints format to STDOUT\\
Code Description\\
**%c** character value\\
**%s** string of characters\\
**%d** signed integer\\
**%i** signed integer\\
**%f** floating point value\\
**%e** scientific notation, with a lowercase "e"\\
**%E** scientific notation, with a uppercase "E"\\
**%g** use **%e** or **%f**\\
**%G** use **%E** or **%f** \\
**%o** octal\\
**%u** unsigned integer\\
**%x** unsigned hexadecimal, with lowercase letters\\
**%X** unsigned hexadecimal, with uppercase letters\\
**%p** a pointer\\
**%n** the argument shall be a pointer to an integer in which the number of characters written is placed\\
**%%** shall be a **%** sign\\
\n (newline)
\t (tab)
\v (vertical tab)
\f (new page)
\b (backspace)
\r (carriage return)
\n (newline)
===== C Sourcecode Example =====
/*
* printf example code
* http://code-reference.com/c/stdio.h/printf
*/
#include /* including standard library */
//#include /* uncomment this for Windows */
int main ( void ) {
int number;
number=42;
printf("the answer to life the universe and everything is %i \n", number);
return 0;
}
==== output ====
the answer to life the universe and everything is 42