libft
Loading...
Searching...
No Matches
vec_resize.c File Reference
#include "vec.h"

Go to the source code of this file.

Functions

int vec_resize (t_vec *src, size_t target_len)
 Resizes vector.
 

Function Documentation

◆ vec_resize()

int vec_resize ( t_vec src,
size_t  target_len 
)

Resizes vector.

Creates a new srcs elem_size * target_len bytes sized vector and copies srcs memory to it, frees the src memory and sets src to be the newly created vector.

Parameters
srct_vec
target_lensize_t length of the resized vector
Returns
int -1 if malloc fails otherwise 1

Definition at line 17 of file vec_resize.c.