-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
write numbers in hexadecimal lower %x (base 16)
- Loading branch information
Walid Araissi
committed
Nov 10, 2022
1 parent
3db125b
commit 108e39c
Showing
1 changed file
with
7 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,20 +6,22 @@ | |
/* By: waraissi <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2022/11/09 18:42:57 by waraissi #+# #+# */ | ||
/* Updated: 2022/11/09 20:15:19 by waraissi ### ########.fr */ | ||
/* Updated: 2022/11/10 17:45:04 by waraissi ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "ft_printf.h" | ||
|
||
void ft_putnbr_base_lower(unsigned int nbr, int *res) | ||
void ft_putnbr_base_lower(unsigned int nbr, int *res) | ||
{ | ||
char base[] = "0123456789abcdef"; | ||
char *base; | ||
|
||
base = "0123456789abcdef"; | ||
if (nbr < 16) | ||
ft_putchar(base[nbr], res); | ||
ft_putchar(base[nbr], res); | ||
else | ||
{ | ||
ft_putnbr_base_lower(nbr / 16, res); | ||
ft_putnbr_base_lower(nbr % 16, res); | ||
} | ||
} | ||
} |