/libft

42 libft project - recreate C Library functions

Primary LanguageC

Logo

libft

This project creates a library with standard libc functions and several other generic functions, which will be used for other 42 projects.

The purpose is not to reinvent the wheels, but to help us develop a deep understanding of the standard libc functions and how to use them.

Technical considerations

  • Allowed functions: malloc, free, write
  • All heap allocated memory space must be properly freed when necessary

Included functions

libc functionss

string manipulation

linked list manipulation

How to test

To test the library, create a test.c file to compile with the libft.a library

# include "libft.h"
# include <stdio.h>

int	main(void)
{
	char	*str;
	int	ret;

	str = "123456789";
	ret = ft_atoi(str);
	printf("ret is %d\n", ret);
	return (0);
}

Run the commands below. You can replace the test.c with your own test file

$ git clone https://github.com/qingqingqingli/libft.git
$ cd libft
$ make
$ make bonus
$ gcc test.c libft.a
$ ./a.out

Examples

  • Create libft.a libft_0

  • Add bonus function to libft.a and compile with test.c libft_1