tgrekov-libft
HIVE libft Oct 2023
Loading...
Searching...
No Matches
ft_strmapi.c File Reference

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strmapi.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/27 23:54:37 by tgrekov #+# #+# */
/* Updated: 2023/11/09 20:12:09 by tgrekov ### ########.fr */
/* */
/* ************************************************************************** */

Definition in file ft_strmapi.c.

#include "libft.h"
Include dependency graph for ft_strmapi.c:

Go to the source code of this file.

Functions

char * ft_strmapi (char const *s, char(*f)(unsigned int, char))
 Allocates and creates a new string from the output of function f processing each character of string s.
 

Function Documentation

◆ ft_strmapi()

char * ft_strmapi ( char const *  s,
char(*)(unsigned int, char)  f 
)

Allocates and creates a new string from the output of function f processing each character of string s.

This function iterates from end to start

Parameters
[in]sNull-terminated string to iterate over
[in]fPointer to a function that returns each character of the new string individually, provided the index and value of each original character
Return values
char*Null-terminated string populated from successive applications of f. Result of malloc.

Definition at line 34 of file ft_strmapi.c.

References ft_calloc(), and ft_strlen().

Here is the call graph for this function: