---
title: "Define and write syntax of putchar()"
subject: "Computer Programming"
chapter: 4
key: "semester_1/computer_programming:syntax-putchar"
source: https://www.bctengineer.com/q/semester_1/computer_programming/syntax-putchar
site: BCT Engineering
---

# Define and write syntax of putchar()

Computer Programming · Chapter 4: Input and Output

- Asked in: 2072 Chaitra, 1 marks
- Video: [Getchar() and putchar() functions in c](https://www.youtube.com/watch?v=tXX6pHvjCTk) — VirtualStudytime
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_1/computer_programming/syntax-putchar
- Whole chapter: https://www.bctengineer.com/md/semester_1/computer_programming/chapter-4

## Question

Define and write syntax of putchar().

## Short answer

putchar(ch) outputs a single character to stdout. The argument can be a char variable, constant, or integer ASCII code. It returns the character written. Example: putchar('A');

## Answer

`putchar()` is an unformatted output function that writes a single character to the screen (standard output). It is declared in `<stdio.h>`.

**Syntax:** `putchar(character);`

The argument is a character constant, a `char` variable, or an integer ASCII code. It returns the character written.

```c
#include <stdio.h>
int main(void)
{
    char ch = 'N';
    putchar(ch);
    putchar('e');
    putchar(65);     /* prints A */
    putchar('\n');
    return 0;
}
```
Output (65 is the ASCII code of A):
```text
NeA
```

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. putchar() writes:
   A. A string
   B. A single character
   C. A float
   D. A line from keyboard
   Answer: B. It outputs one character. (Key point: Purpose)

2. putchar(65) prints:
   A. 65
   B. A
   C. a
   D. 6
   Answer: B. 65 is the ASCII code of A. (Key point: ASCII)

3. putchar is:
   A. Formatted output
   B. Unformatted output
   C. Input function
   D. Memory function
   Answer: B. It is an unformatted output function in <stdio.h>. (Key point: Type)
