2024-12-09 18:34:15 +00:00
|
|
|
---
|
|
|
|
id: 3hcv0amc
|
|
|
|
tags:
|
|
|
|
- C
|
|
|
|
created: Thursday, February 29, 2024 | 17:33
|
|
|
|
---
|
|
|
|
|
|
|
|
# Printing values in C
|
|
|
|
|
|
|
|
## To print a literal
|
|
|
|
|
|
|
|
```c
|
|
|
|
printf("hello world")
|
|
|
|
```
|
|
|
|
|
|
|
|
## To print a variable
|
|
|
|
|
|
|
|
```c
|
|
|
|
int age = 25
|
|
|
|
print("%d", age)
|
|
|
|
|
|
|
|
```
|
|
|
|
|
2025-01-16 07:08:09 +00:00
|
|
|
The `%d` is an example of a [format specifier](format-specifiers-in-c.md).
|
2024-12-09 18:34:15 +00:00
|
|
|
It is the decimal integer format specifier.
|