C Printf Format Specifiers Guide
In C language, string format can be set using the printf function, commonly used formats include:
- %s: used for displaying string
- %c: used to output characters.
- %d: used to print integers
- %f: used to output a floating-point number.
- %x: Used to display a hexadecimal number.
- %p: used to output the address of a pointer.
For example, you can format the output of a string and an integer like this:
char str[] = "Hello";
int num = 100;
printf("%s %d\n", str, num);
You can choose the appropriate format to output different types of data as needed.