eolas/zk/Format_specifiers_in_C.md

29 lines
557 B
Markdown
Raw Normal View History

2024-02-29 18:39:53 +00:00
---
id: 5faz2y2e
2024-06-16 18:15:03 +01:00
tags:
- C
2024-02-29 18:39:53 +00:00
created: Thursday, February 29, 2024 | 17:41
---
# Format specifiers in C
2025-12-03 18:02:31 +00:00
| Specifier | Usage |
| --------- | ------- |
| `%c` | char |
| `%s` | string |
| `%n` | nothing |
| `%i` | integer |
| `%f` | float |
2025-12-15 17:26:02 +00:00
| `%p` | pointer |
2025-12-03 18:02:31 +00:00
2025-12-03 17:59:30 +00:00
Format specifiers define the type of data to be printed or interpolated in
standard output. You need to use format specifiers whenever you are
[printing values in C](./Printing_values_in_C.md).
2024-02-29 18:39:53 +00:00
2025-12-03 17:59:30 +00:00
For example:
```c
int age = 37
printf("My age is %i", age)
```