Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ft_libft is a 42 school project that involves building a custom library of useful C functions. The library includes functions for memory manipulation, string manipulation, and other common operations in C programming. The project requires a solid understanding of data structures, memory management, and the standard library functions in C.

License

NotificationsYou must be signed in to change notification settings

iLucasPires/ft_libft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OSLanguageGradeStatus

libft

This project is about creating a library with useful functions for future projects.

How to use

  • Clone the repository
  • Runmake to compile the library
  • Include the header filelibft.h in your project
  • Compile your project with the librarylibft.a

Mandatory part

  • the project must be written in accordance with the Norm
  • the project must be written in the C language
  • the functions must be prototyped in a header file calledlibft.h
  • the functions must be written in separate.c files
  • the functions must be compiled with the flags-Wall,-Wextra, and-Werror
  • the library must be namedlibft.a

Part 1 - Libc functions

FunctionDescription
ft_isalphaChecks if the character is an alphabetic character
ft_isdigitChecks if the character is a digit
ft_isalnumChecks if the character is an alphanumeric character
ft_isasciiChecks if the character is an ASCII character
ft_isprintChecks if the character is a printable character
ft_toupperConverts a lowercase letter to uppercase
ft_tolowerConverts an uppercase letter to lowercase
ft_strlenCalculates the length of a string
ft_memsetFills the first n bytes of the memory area pointed to by s with the constant byte c
ft_bzeroWrites n zeroed bytes to the string s
ft_memcpyCopies n bytes from memory area src to memory area dest
ft_memccpyCopies bytes from string src to string dest
ft_memmoveCopies n bytes from memory area src to memory area dest
ft_memchrLocates the first occurrence of c (converted to an unsigned char) in string s
ft_memcmpCompares byte string s1 against byte string s2
ft_strlcpyCopies up to size - 1 characters from the NUL-terminated string src to dst
ft_strlcatAppends the NUL-terminated string src to the end of dst
ft_strchrLocates the first occurrence of c (converted to a char) in the string pointed to by s
ft_strrchrLocates the last occurrence of c (converted to a char) in the string pointed to by s
ft_strnstrLocates the first occurrence of the null-terminated string little in the string big
ft_strncmpCompares not more than n characters. Because strncmp() is designed for comparing strings rather than binary data, characters that appear after a `\0' character are not compared
ft_atoiConverts the initial portion of the string pointed to by str to int representation
ft_callocAllocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory
ft_strdupAllocates sufficient memory for a copy of the string s1, does the copy, and returns a pointer to it

Part 2 - Additional functions

FunctionDescription
ft_substrAllocates (with malloc(3)) and returns a substring from the string ’s’. The substring begins at index ’start’ and is of maximum size ’len’
ft_strjoinAllocates (with malloc(3)) and returns a new string, which is the result of the concatenation of ’s1’ and ’s2’
ft_strtrimAllocates (with malloc(3)) and returns a copy of ’s1’ with the characters specified in ’set’ removed from the beginning and the end of the string.
ft_splitAllocates (with malloc(3)) and returns an array of strings obtained by splitting ’s’ using the character ’c’ as a delimiter. The array must end with a NULL pointer
ft_itoaAllocates (with malloc(3)) and returns a string representing the integer received as an argument. Negative numbers must be handled.
ft_strmapiApplies the function ’f’ to each character of the string ’s’, and passing its index as first argument to create a new string (with malloc(3)) resulting from successive applications of ’f’.
ft_putchar_fdOutputs the character ’c’ to the given file descriptor.
ft_putstr_fdOutputs the string ’s’ to the given file descriptor.
ft_putendl_fdOutputs the string ’s’ to the given file descriptor, followed by a newline.
ft_putnbr_fdOutputs the integer ’n’ to the given file descriptor.

Exemple

cc -Wall -Wextra -Werror -I libft.h -L libft.a main.c
#include"libft.h"intmain(void){char*str="Hello World!";ft_putstr_fd(str,1);return (0);}

About

Ft_libft is a 42 school project that involves building a custom library of useful C functions. The library includes functions for memory manipulation, string manipulation, and other common operations in C programming. The project requires a solid understanding of data structures, memory management, and the standard library functions in C.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp