ft_toupper: initial implementation

This commit is contained in:
Khaïs COLIN 2024-10-16 10:28:00 +02:00
parent 870ce44765
commit 21e04cc22c
3 changed files with 42 additions and 3 deletions

View file

@ -6,7 +6,7 @@
# By: kcolin <marvin@42.fr> +#+ +:+ +#+ # # By: kcolin <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2024/10/14 13:43:59 by kcolin #+# #+# # # Created: 2024/10/14 13:43:59 by kcolin #+# #+# #
# Updated: 2024/10/15 16:00:12 by kcolin ### ########.fr # # Updated: 2024/10/16 09:58:22 by kcolin ### ########.fr #
# # # #
# **************************************************************************** # # **************************************************************************** #
@ -23,7 +23,8 @@ SOURCES = ft_isalpha.c \
ft_memcpy.c \ ft_memcpy.c \
ft_memmove.c \ ft_memmove.c \
ft_strlcpy.c \ ft_strlcpy.c \
ft_strlcat.c ft_strlcat.c \
ft_toupper.c
OBJECTS = $(SOURCES:.c=.o) OBJECTS = $(SOURCES:.c=.o)
CC = gcc CC = gcc

36
ft_toupper.c Normal file
View file

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_toupper.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/16 09:58:42 by kcolin #+# #+# */
/* Updated: 2024/10/16 10:25:57 by kcolin ### ########.fr */
/* */
/* ************************************************************************** */
int ft_toupper(int c)
{
if (c >= 'a' && c <= 'z')
c -= 0x20;
return (c);
}
/*
#include <stdio.h>
#include <ctype.h>
int main(void)
{
int i;
i = 0;
while (i < 256)
{
printf("%d\t%c\t%c\t%c\n", i, i, ft_toupper(i), toupper(i));
i++;
}
return (0);
}
*/

View file

@ -6,7 +6,7 @@
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */ /* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/15 10:11:54 by kcolin #+# #+# */ /* Created: 2024/10/15 10:11:54 by kcolin #+# #+# */
/* Updated: 2024/10/15 15:59:51 by kcolin ### ########.fr */ /* Updated: 2024/10/16 10:24:26 by kcolin ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -30,4 +30,6 @@ void *ft_memmove(void *dest, const void *src, t_size n);
t_size ft_strlcpy(char *dst, const char *src, t_size size); t_size ft_strlcpy(char *dst, const char *src, t_size size);
t_size ft_strlcat(char *dst, const char *src, t_size size); t_size ft_strlcat(char *dst, const char *src, t_size size);
int ft_toupper(int c);
#endif #endif