printf types c code example
Example 1: How to make a printf in c
#include <stdio.h>
int printf(const char *format, ...);
int main(void)
{
int nb = 20;
printf("Hello World !\n");
printf("%d\n", nb);
printf("%s/%d\n", "Nice", 20);
return (0);
}
Example 2: printf data types c
c Character
d or i Signed decimal integer
e Scientific notation (mantissa/exponent) using e character
E Scientific notation (mantissa/exponent) using E character
f Decimal floating point
g Uses the shorter of %e or %f
G Uses the shorter of %E or %f
o Signed octal
s String of characters
u Unsigned decimal integer
x Unsigned hexadecimal integer
X Unsigned hexadecimal integer (capital letters)
p Pointer address
n Nothing printed
% Character