# ft\_isprint

### Subject

{% code overflow="wrap" %}

```
ISPRINT(3) (simplified)

NAME
    isprint -- printing character test (space character inclusive)
SYNOPSIS
    int isprint(int c)
DESCRIPTION
    The isprint() function tests for any printing character, including space. The value of the argument must representable as an unsigned char or the value of EOF.
RETURN VALUES
    The isprint() function returns zero if the character tests false and returns non-zero if the character tests true.
```

{% endcode %}

### Understandable explanation

For this function, the man is pretty self-explanatory, but I'll give more details (i.e. what are the printing characters).

The `isprint()` function returns a non-zero value if the character passed as an `int` parameter is a printing character.

If the character is not a printing character, the `isprint()` function returns `0`.

The printing characters are all character between decimal 32 and decimal 126.

### Hints

{% code title="ft\_isprint.c" overflow="wrap" lineNumbers="true" %}

```c
int    ft_isprint(int c)
{
    if (/* c is between 32 and 126 */)
        return (/* non-zero value of your choice */);
    return (0);
}
```

{% endcode %}

### Commented solution

<details>

<summary>ft_isprint</summary>

{% code title="ft\_isprint.c" overflow="wrap" lineNumbers="true" %}

```c
#include "libft.h"

int    ft_isprint(int c)
{
    /* check if c is between decimal 32 and decimal 126 (inclusive) */
    if (c >= 32 && c <= 126)
        return (c); // if we reach this point, c will be a non-zero value.
    return (0);
}
```

{% endcode %}

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://42-cursus.gitbook.io/guide/0-rank-00/libft/libc-functions/ft_isprint.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
