-
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 upper %X (base 16)
- Loading branch information
Walid Araissi
committed
Nov 10, 2022
1 parent
108e39c
commit 3d454a7
Showing
1 changed file
with
8 additions
and
6 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:43:07 by waraissi #+# #+# */ | ||
/* Updated: 2022/11/09 20:16:28 by waraissi ### ########.fr */ | ||
/* Updated: 2022/11/10 18:10:06 by waraissi ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "ft_printf.h" | ||
|
||
void ft_putnbr_base_upper(unsigned int nbr, int *res) | ||
void ft_putnbr_base_upper(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_upper(nbr / 16, res ); | ||
ft_putnbr_base_upper(nbr / 16, res); | ||
ft_putnbr_base_upper(nbr % 16, res); | ||
} | ||
} | ||
} |