libft / ft_memset.c 109 commits
14-04-2026
23 lines 1.0 kB
 1/* ************************************************************************** */
 2/*                                                                            */
 3/*                                                        :::      ::::::::   */
 4/*   ft_memset.c                                        :+:      :+:    :+:   */
 5/*                                                    +:+ +:+         +:+     */
 6/*   By: mleitao <mleitao@student.42.fr>            +#+  +:+       +#+        */
 7/*                                                +#+#+#+#+#+   +#+           */
 8/*   Created: 2026/03/09 19:57:57 by mleitao           #+#    #+#             */
 9/*   Updated: 2026/04/14 19:20:36 by mleitao          ###   ########.fr       */
10/*                                                                            */
11/* ************************************************************************** */
12
13#include "libft.h"
14
15void	*ft_memset(void *s, int c, size_t n)
16{
17	unsigned char	*p;
18
19	p = (unsigned char *)s;
20	while (n--)
21		*p++ = c;
22	return (s);
23}