Libft
 
Loading...
Searching...
No Matches
Memory functions

Memory functions. More...

Functions

void ft_bzero (void *s, size_t n)
 Set at 0, the n first bytes at the pointer adress.
 
void * ft_memcpy (void *destination, const void *source, size_t size)
 Set a memory zone with a value, count times.
 
void * ft_memset (void *pointer, int value, size_t count)
 Set a memory zone with a value, count times.
 
void * ft_memmove (void *destination, const void *source, size_t size)
 Moves the memory blocks avoiding overlapping, until size blocks.
 
const void * ft_memchr (const void *memory_block, int searched_char, size_t size)
 Research the first occurence of a value typed int, but interpreted as a char in a memory block.
 
int ft_memcmp (const void *src, const void *set, size_t size)
 Compares the first size bytes of the memory areas src and set.
 
void * ft_calloc (size_t element_count, size_t element_size)
 Allocates a new memory zone, and set all bits to zero.
 

Detailed Description

Memory functions.

Function Documentation

◆ ft_bzero()

void ft_bzero ( void * s,
size_t n )

Set at 0, the n first bytes at the pointer adress.

Parameters
spointer to the memory to set
nnumber of bytes to set at 0

◆ ft_calloc()

void * ft_calloc ( size_t element_count,
size_t element_size )

Allocates a new memory zone, and set all bits to zero.

Parameters
element_countnumber of elements
element_sizesize of each element
Returns
void* pointer to the new memory zone
Here is the call graph for this function:

◆ ft_memchr()

const void * ft_memchr ( const void * memory_block,
int searched_char,
size_t size )

Research the first occurence of a value typed int, but interpreted as a char in a memory block.

Parameters
memory_blockmemory block to search in
searched_charvalue to search
sizesize of the memory block
Returns
void* pointer to the first occurence of the value or NULL if not found

◆ ft_memcmp()

int ft_memcmp ( const void * src,
const void * set,
size_t size )

Compares the first size bytes of the memory areas src and set.

Parameters
srcsource memory block
setset memory block
sizesize of the memory block
Returns
int difference between the first different byte

◆ ft_memcpy()

void * ft_memcpy ( void * destination,
const void * source,
size_t size )

Set a memory zone with a value, count times.

Parameters
destinationmemory zone to paste
sourcememory zone to copy
sizenumber of times to set the value
Returns
void* pointer to the memory zone

◆ ft_memmove()

void * ft_memmove ( void * destination,
const void * source,
size_t size )

Moves the memory blocks avoiding overlapping, until size blocks.

Parameters
destinationdestination memory block
sourcesource memory block
sizesize of the memory block
Returns
void* pointer to the destination memory block

◆ ft_memset()

void * ft_memset ( void * pointer,
int value,
size_t count )

Set a memory zone with a value, count times.

Parameters
pointermemory zone to set
valuevalue to set
countnumber of times to set the value
Returns
void* pointer to the memory zone