maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
ft_memcpy.c
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* ft_memcpy.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: rmikhayl <rmikhayl@student.42london.c +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2023/12/17 17:25:27 by rmikhayl #+# #+# */
9/* Updated: 2023/12/17 17:25:27 by rmikhayl ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#include "libft.h"
14
15/* *************************** ft_memcpy ************************************ */
16/* Copies 'n' bytes from 'src' to 'dest' and returns 'dest' (new mem block) */
17/* */
18/* In layman's terms: It duplicates a block of data from one place to */
19/* another and gives you the destination block. */
20/* ************************************************************************** */
21
22void *ft_memcpy(void *dest, const void *src, size_t n)
23{
24 char *d;
25 const char *s;
26
27 if (!dest && !src)
28 return (NULL);
29 s = src;
30 d = dest;
31 while (n--)
32 *d++ = *s++;
33 return (dest);
34}
void * ft_memcpy(void *dest, const void *src, size_t n)
Definition ft_memcpy.c:22